28139 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 (5)
RequiresUnsafeCodeFixProvider.cs (5)
207SyntaxKind.SimpleAssignmentExpression, 394isVoid = method.ReturnType is PredefinedTypeSyntax pts && pts.Keyword.IsKind(SyntaxKind.VoidKeyword); 398isVoid = localFunc.ReturnType is PredefinedTypeSyntax pts && pts.Keyword.IsKind(SyntaxKind.VoidKeyword); 450var getter = SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) 469var indexerGetter = SyntaxFactory.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration)
ILLink.RoslynAnalyzer (12)
RequiresAnalyzerBase.cs (2)
66private protected virtual ImmutableArray<(Action<SyntaxNodeAnalysisContext> Action, SyntaxKind[] SyntaxKind)> ExtraSyntaxNodeActions { get; } = ImmutableArray<(Action<SyntaxNodeAnalysisContext> Action, SyntaxKind[] SyntaxKind)>.Empty;
RequiresUnsafeAnalyzer.cs (10)
69if (node.IsKind(SyntaxKind.UnsafeStatement)) 73if (node is MethodDeclarationSyntax method && method.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 75if (node is LocalFunctionStatementSyntax localFunc && localFunc.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 77if (node is PropertyDeclarationSyntax prop && prop.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 79if (node is IndexerDeclarationSyntax indexer && indexer.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 81if (node is OperatorDeclarationSyntax op && op.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 83if (node is ConversionOperatorDeclarationSyntax conv && conv.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 85if (node is ConstructorDeclarationSyntax ctor && ctor.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 87if (node is FieldDeclarationSyntax field && field.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 89if (node is TypeDeclarationSyntax type && type.Modifiers.Any(SyntaxKind.UnsafeKeyword))
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); 41&& modifiers.Any(SyntaxKind.PublicKeyword) 42&& modifiers.Any(SyntaxKind.PartialKeyword)
Microsoft.AspNetCore.App.CodeFixes (7)
Authorization\AddAuthorizationBuilderFixer.cs (2)
120.Where(trivia => !trivia.IsKind(SyntaxKind.EndOfLineTrivia)); 128SyntaxKind.SimpleMemberAccessExpression,
Dependencies\ExtensionMethodsCompletionProvider.cs (3)
90if (current?.IsKind(SyntaxKind.SimpleMemberAccessExpression) ?? false) 114var isIdentifierToken = token.IsKind(SyntaxKind.IdentifierName) || token.IsKind(SyntaxKind.IdentifierToken);
Http\HeaderDictionaryAddFixer.cs (1)
125SyntaxKind.SimpleAssignmentExpression,
Http\HeaderDictionaryIndexerFixer.cs (1)
59var newExpression = SyntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expression, SyntaxFactory.IdentifierName(resolvedPropertyName));
Microsoft.AspNetCore.Components.Analyzers (14)
ComponentParameterAnalyzer.cs (3)
157if (getterAccessor.IsKind(SyntaxKind.SetAccessorDeclaration)) 163if (!getterAccessor.IsKind(SyntaxKind.GetAccessorDeclaration) || !setterAccessor.IsKind(SyntaxKind.SetAccessorDeclaration))
ComponentParametersShouldBePublicCodeFixProvider.cs (5)
72if (modifier.IsKind(SyntaxKind.PrivateKeyword) || 73modifier.IsKind(SyntaxKind.ProtectedKeyword) || 74modifier.IsKind(SyntaxKind.InternalKeyword) || 77modifier.IsKind(SyntaxKind.PublicKeyword)) 83var publicModifier = SyntaxFactory.Token(SyntaxKind.PublicKeyword);
PersistentStateAnalyzer.cs (3)
81}, SyntaxKind.PropertyDeclaration); 94LiteralExpressionSyntax literal when literal.Token.IsKind(SyntaxKind.DefaultKeyword) => true, 97when literal.Token.IsKind(SyntaxKind.DefaultKeyword) => true,
SupplyParameterFromFormAnalyzer.cs (3)
81}, SyntaxKind.PropertyDeclaration); 94LiteralExpressionSyntax literal when literal.Token.IsKind(SyntaxKind.DefaultKeyword) => true, 97when literal.Token.IsKind(SyntaxKind.DefaultKeyword) => true,
Microsoft.AspNetCore.Components.SdkAnalyzers (5)
ComponentParametersShouldBePublicCodeFixProvider.cs (5)
72if (modifier.IsKind(SyntaxKind.PrivateKeyword) || 73modifier.IsKind(SyntaxKind.ProtectedKeyword) || 74modifier.IsKind(SyntaxKind.InternalKeyword) || 77modifier.IsKind(SyntaxKind.PublicKeyword)) 83var publicModifier = SyntaxFactory.Token(SyntaxKind.PublicKeyword);
Microsoft.AspNetCore.Mvc.Api.Analyzers (2)
AddResponseTypeAttributeCodeFixAction.cs (2)
236SyntaxKind.SimpleMemberAccessExpression, 243return SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal(statusCode));
Microsoft.CodeAnalysis.CSharp (12223)
_generated\0\Syntax.xml.Main.Generated.cs (1521)
2268case SyntaxKind.IdentifierToken: 2269case SyntaxKind.GlobalKeyword: break; 2279if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 2286=> SyntaxFactory.QualifiedName(left, SyntaxFactory.Token(SyntaxKind.DotToken), right); 2291if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 2307if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 2308if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 2314=> SyntaxFactory.TypeArgumentList(SyntaxFactory.Token(SyntaxKind.LessThanToken), arguments, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 2320if (colonColonToken.Kind() != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); 2327=> SyntaxFactory.AliasQualifiedName(alias, SyntaxFactory.Token(SyntaxKind.ColonColonToken), name); 2331=> SyntaxFactory.AliasQualifiedName(SyntaxFactory.IdentifierName(alias), SyntaxFactory.Token(SyntaxKind.ColonColonToken), name); 2338case SyntaxKind.BoolKeyword: 2339case SyntaxKind.ByteKeyword: 2340case SyntaxKind.SByteKeyword: 2341case SyntaxKind.IntKeyword: 2342case SyntaxKind.UIntKeyword: 2343case SyntaxKind.ShortKeyword: 2344case SyntaxKind.UShortKeyword: 2345case SyntaxKind.LongKeyword: 2346case SyntaxKind.ULongKeyword: 2347case SyntaxKind.FloatKeyword: 2348case SyntaxKind.DoubleKeyword: 2349case SyntaxKind.DecimalKeyword: 2350case SyntaxKind.StringKeyword: 2351case SyntaxKind.CharKeyword: 2352case SyntaxKind.ObjectKeyword: 2353case SyntaxKind.VoidKeyword: break; 2373if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 2374if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 2380=> SyntaxFactory.ArrayRankSpecifier(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), sizes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 2386if (asteriskToken.Kind() != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 2392=> SyntaxFactory.PointerType(elementType, SyntaxFactory.Token(SyntaxKind.AsteriskToken)); 2397if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 2398if (asteriskToken.Kind() != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 2405=> SyntaxFactory.FunctionPointerType(SyntaxFactory.Token(SyntaxKind.DelegateKeyword), SyntaxFactory.Token(SyntaxKind.AsteriskToken), callingConvention, parameterList); 2409=> SyntaxFactory.FunctionPointerType(SyntaxFactory.Token(SyntaxKind.DelegateKeyword), SyntaxFactory.Token(SyntaxKind.AsteriskToken), default, SyntaxFactory.FunctionPointerParameterList()); 2414if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 2415if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 2421=> SyntaxFactory.FunctionPointerParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), parameters, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 2428case SyntaxKind.ManagedKeyword: 2429case SyntaxKind.UnmanagedKeyword: break; 2442if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 2443if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 2449=> SyntaxFactory.FunctionPointerUnmanagedCallingConventionList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), callingConventions, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 2454if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 2462if (questionToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 2468=> SyntaxFactory.NullableType(elementType, SyntaxFactory.Token(SyntaxKind.QuestionToken)); 2473if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 2474if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 2480=> SyntaxFactory.TupleType(SyntaxFactory.Token(SyntaxKind.OpenParenToken), elements, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 2488case SyntaxKind.IdentifierToken: 2489case SyntaxKind.None: break; 2502if (omittedTypeArgumentToken.Kind() != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); 2508=> SyntaxFactory.OmittedTypeArgument(SyntaxFactory.Token(SyntaxKind.OmittedTypeArgumentToken)); 2513if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 2516case SyntaxKind.ReadOnlyKeyword: 2517case SyntaxKind.None: break; 2526=> SyntaxFactory.RefType(SyntaxFactory.Token(SyntaxKind.RefKeyword), default, type); 2531if (scopedKeyword.Kind() != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); 2538=> SyntaxFactory.ScopedType(SyntaxFactory.Token(SyntaxKind.ScopedKeyword), type); 2543if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 2545if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 2551=> SyntaxFactory.ParenthesizedExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 2556if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 2557if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 2563=> SyntaxFactory.TupleExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 2566public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) 2570case SyntaxKind.UnaryPlusExpression: 2571case SyntaxKind.UnaryMinusExpression: 2572case SyntaxKind.BitwiseNotExpression: 2573case SyntaxKind.LogicalNotExpression: 2574case SyntaxKind.PreIncrementExpression: 2575case SyntaxKind.PreDecrementExpression: 2576case SyntaxKind.AddressOfExpression: 2577case SyntaxKind.PointerIndirectionExpression: 2578case SyntaxKind.IndexExpression: break; 2583case SyntaxKind.PlusToken: 2584case SyntaxKind.MinusToken: 2585case SyntaxKind.TildeToken: 2586case SyntaxKind.ExclamationToken: 2587case SyntaxKind.PlusPlusToken: 2588case SyntaxKind.MinusMinusToken: 2589case SyntaxKind.AmpersandToken: 2590case SyntaxKind.AsteriskToken: 2591case SyntaxKind.CaretToken: break; 2599public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand) 2602private static SyntaxKind GetPrefixUnaryExpressionOperatorTokenKind(SyntaxKind kind) 2605SyntaxKind.UnaryPlusExpression => SyntaxKind.PlusToken, 2606SyntaxKind.UnaryMinusExpression => SyntaxKind.MinusToken, 2607SyntaxKind.BitwiseNotExpression => SyntaxKind.TildeToken, 2608SyntaxKind.LogicalNotExpression => SyntaxKind.ExclamationToken, 2609SyntaxKind.PreIncrementExpression => SyntaxKind.PlusPlusToken, 2610SyntaxKind.PreDecrementExpression => SyntaxKind.MinusMinusToken, 2611SyntaxKind.AddressOfExpression => SyntaxKind.AmpersandToken, 2612SyntaxKind.PointerIndirectionExpression => SyntaxKind.AsteriskToken, 2613SyntaxKind.IndexExpression => SyntaxKind.CaretToken, 2620if (awaitKeyword.Kind() != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); 2627=> SyntaxFactory.AwaitExpression(SyntaxFactory.Token(SyntaxKind.AwaitKeyword), expression); 2630public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) 2634case SyntaxKind.PostIncrementExpression: 2635case SyntaxKind.PostDecrementExpression: 2636case SyntaxKind.SuppressNullableWarningExpression: break; 2642case SyntaxKind.PlusPlusToken: 2643case SyntaxKind.MinusMinusToken: 2644case SyntaxKind.ExclamationToken: break; 2651public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand) 2654private static SyntaxKind GetPostfixUnaryExpressionOperatorTokenKind(SyntaxKind kind) 2657SyntaxKind.PostIncrementExpression => SyntaxKind.PlusPlusToken, 2658SyntaxKind.PostDecrementExpression => SyntaxKind.MinusMinusToken, 2659SyntaxKind.SuppressNullableWarningExpression => SyntaxKind.ExclamationToken, 2664public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) 2668case SyntaxKind.SimpleMemberAccessExpression: 2669case SyntaxKind.PointerMemberAccessExpression: break; 2675case SyntaxKind.DotToken: 2676case SyntaxKind.MinusGreaterThanToken: break; 2684public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SimpleNameSyntax name) 2687private static SyntaxKind GetMemberAccessExpressionOperatorTokenKind(SyntaxKind kind) 2690SyntaxKind.SimpleMemberAccessExpression => SyntaxKind.DotToken, 2691SyntaxKind.PointerMemberAccessExpression => SyntaxKind.MinusGreaterThanToken, 2699if (operatorToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); 2706=> SyntaxFactory.ConditionalAccessExpression(expression, SyntaxFactory.Token(SyntaxKind.QuestionToken), whenNotNull); 2711if (operatorToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); 2718=> SyntaxFactory.MemberBindingExpression(SyntaxFactory.Token(SyntaxKind.DotToken), name); 2734if (operatorToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 2740=> SyntaxFactory.RangeExpression(leftOperand, SyntaxFactory.Token(SyntaxKind.DotDotToken), rightOperand); 2744=> SyntaxFactory.RangeExpression(default, SyntaxFactory.Token(SyntaxKind.DotDotToken), default); 2758public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 2762case SyntaxKind.AddExpression: 2763case SyntaxKind.SubtractExpression: 2764case SyntaxKind.MultiplyExpression: 2765case SyntaxKind.DivideExpression: 2766case SyntaxKind.ModuloExpression: 2767case SyntaxKind.LeftShiftExpression: 2768case SyntaxKind.RightShiftExpression: 2769case SyntaxKind.UnsignedRightShiftExpression: 2770case SyntaxKind.LogicalOrExpression: 2771case SyntaxKind.LogicalAndExpression: 2772case SyntaxKind.BitwiseOrExpression: 2773case SyntaxKind.BitwiseAndExpression: 2774case SyntaxKind.ExclusiveOrExpression: 2775case SyntaxKind.EqualsExpression: 2776case SyntaxKind.NotEqualsExpression: 2777case SyntaxKind.LessThanExpression: 2778case SyntaxKind.LessThanOrEqualExpression: 2779case SyntaxKind.GreaterThanExpression: 2780case SyntaxKind.GreaterThanOrEqualExpression: 2781case SyntaxKind.IsExpression: 2782case SyntaxKind.AsExpression: 2783case SyntaxKind.CoalesceExpression: break; 2789case SyntaxKind.PlusToken: 2790case SyntaxKind.MinusToken: 2791case SyntaxKind.AsteriskToken: 2792case SyntaxKind.SlashToken: 2793case SyntaxKind.PercentToken: 2794case SyntaxKind.LessThanLessThanToken: 2795case SyntaxKind.GreaterThanGreaterThanToken: 2796case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 2797case SyntaxKind.BarBarToken: 2798case SyntaxKind.AmpersandAmpersandToken: 2799case SyntaxKind.BarToken: 2800case SyntaxKind.AmpersandToken: 2801case SyntaxKind.CaretToken: 2802case SyntaxKind.EqualsEqualsToken: 2803case SyntaxKind.ExclamationEqualsToken: 2804case SyntaxKind.LessThanToken: 2805case SyntaxKind.LessThanEqualsToken: 2806case SyntaxKind.GreaterThanToken: 2807case SyntaxKind.GreaterThanEqualsToken: 2808case SyntaxKind.IsKeyword: 2809case SyntaxKind.AsKeyword: 2810case SyntaxKind.QuestionQuestionToken: break; 2818public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, ExpressionSyntax right) 2821private static SyntaxKind GetBinaryExpressionOperatorTokenKind(SyntaxKind kind) 2824SyntaxKind.AddExpression => SyntaxKind.PlusToken, 2825SyntaxKind.SubtractExpression => SyntaxKind.MinusToken, 2826SyntaxKind.MultiplyExpression => SyntaxKind.AsteriskToken, 2827SyntaxKind.DivideExpression => SyntaxKind.SlashToken, 2828SyntaxKind.ModuloExpression => SyntaxKind.PercentToken, 2829SyntaxKind.LeftShiftExpression => SyntaxKind.LessThanLessThanToken, 2830SyntaxKind.RightShiftExpression => SyntaxKind.GreaterThanGreaterThanToken, 2831SyntaxKind.UnsignedRightShiftExpression => SyntaxKind.GreaterThanGreaterThanGreaterThanToken, 2832SyntaxKind.LogicalOrExpression => SyntaxKind.BarBarToken, 2833SyntaxKind.LogicalAndExpression => SyntaxKind.AmpersandAmpersandToken, 2834SyntaxKind.BitwiseOrExpression => SyntaxKind.BarToken, 2835SyntaxKind.BitwiseAndExpression => SyntaxKind.AmpersandToken, 2836SyntaxKind.ExclusiveOrExpression => SyntaxKind.CaretToken, 2837SyntaxKind.EqualsExpression => SyntaxKind.EqualsEqualsToken, 2838SyntaxKind.NotEqualsExpression => SyntaxKind.ExclamationEqualsToken, 2839SyntaxKind.LessThanExpression => SyntaxKind.LessThanToken, 2840SyntaxKind.LessThanOrEqualExpression => SyntaxKind.LessThanEqualsToken, 2841SyntaxKind.GreaterThanExpression => SyntaxKind.GreaterThanToken, 2842SyntaxKind.GreaterThanOrEqualExpression => SyntaxKind.GreaterThanEqualsToken, 2843SyntaxKind.IsExpression => SyntaxKind.IsKeyword, 2844SyntaxKind.AsExpression => SyntaxKind.AsKeyword, 2845SyntaxKind.CoalesceExpression => SyntaxKind.QuestionQuestionToken, 2850public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 2854case SyntaxKind.SimpleAssignmentExpression: 2855case SyntaxKind.AddAssignmentExpression: 2856case SyntaxKind.SubtractAssignmentExpression: 2857case SyntaxKind.MultiplyAssignmentExpression: 2858case SyntaxKind.DivideAssignmentExpression: 2859case SyntaxKind.ModuloAssignmentExpression: 2860case SyntaxKind.AndAssignmentExpression: 2861case SyntaxKind.ExclusiveOrAssignmentExpression: 2862case SyntaxKind.OrAssignmentExpression: 2863case SyntaxKind.LeftShiftAssignmentExpression: 2864case SyntaxKind.RightShiftAssignmentExpression: 2865case SyntaxKind.UnsignedRightShiftAssignmentExpression: 2866case SyntaxKind.CoalesceAssignmentExpression: break; 2872case SyntaxKind.EqualsToken: 2873case SyntaxKind.PlusEqualsToken: 2874case SyntaxKind.MinusEqualsToken: 2875case SyntaxKind.AsteriskEqualsToken: 2876case SyntaxKind.SlashEqualsToken: 2877case SyntaxKind.PercentEqualsToken: 2878case SyntaxKind.AmpersandEqualsToken: 2879case SyntaxKind.CaretEqualsToken: 2880case SyntaxKind.BarEqualsToken: 2881case SyntaxKind.LessThanLessThanEqualsToken: 2882case SyntaxKind.GreaterThanGreaterThanEqualsToken: 2883case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 2884case SyntaxKind.QuestionQuestionEqualsToken: break; 2892public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, ExpressionSyntax right) 2895private static SyntaxKind GetAssignmentExpressionOperatorTokenKind(SyntaxKind kind) 2898SyntaxKind.SimpleAssignmentExpression => SyntaxKind.EqualsToken, 2899SyntaxKind.AddAssignmentExpression => SyntaxKind.PlusEqualsToken, 2900SyntaxKind.SubtractAssignmentExpression => SyntaxKind.MinusEqualsToken, 2901SyntaxKind.MultiplyAssignmentExpression => SyntaxKind.AsteriskEqualsToken, 2902SyntaxKind.DivideAssignmentExpression => SyntaxKind.SlashEqualsToken, 2903SyntaxKind.ModuloAssignmentExpression => SyntaxKind.PercentEqualsToken, 2904SyntaxKind.AndAssignmentExpression => SyntaxKind.AmpersandEqualsToken, 2905SyntaxKind.ExclusiveOrAssignmentExpression => SyntaxKind.CaretEqualsToken, 2906SyntaxKind.OrAssignmentExpression => SyntaxKind.BarEqualsToken, 2907SyntaxKind.LeftShiftAssignmentExpression => SyntaxKind.LessThanLessThanEqualsToken, 2908SyntaxKind.RightShiftAssignmentExpression => SyntaxKind.GreaterThanGreaterThanEqualsToken, 2909SyntaxKind.UnsignedRightShiftAssignmentExpression => SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, 2910SyntaxKind.CoalesceAssignmentExpression => SyntaxKind.QuestionQuestionEqualsToken, 2918if (questionToken.Kind() != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 2920if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 2927=> SyntaxFactory.ConditionalExpression(condition, SyntaxFactory.Token(SyntaxKind.QuestionToken), whenTrue, SyntaxFactory.Token(SyntaxKind.ColonToken), whenFalse); 2932if (token.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); 2938=> SyntaxFactory.ThisExpression(SyntaxFactory.Token(SyntaxKind.ThisKeyword)); 2943if (token.Kind() != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); 2949=> SyntaxFactory.BaseExpression(SyntaxFactory.Token(SyntaxKind.BaseKeyword)); 2952public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) 2956case SyntaxKind.ArgListExpression: 2957case SyntaxKind.NumericLiteralExpression: 2958case SyntaxKind.StringLiteralExpression: 2959case SyntaxKind.Utf8StringLiteralExpression: 2960case SyntaxKind.CharacterLiteralExpression: 2961case SyntaxKind.TrueLiteralExpression: 2962case SyntaxKind.FalseLiteralExpression: 2963case SyntaxKind.NullLiteralExpression: 2964case SyntaxKind.DefaultLiteralExpression: break; 2969case SyntaxKind.ArgListKeyword: 2970case SyntaxKind.NumericLiteralToken: 2971case SyntaxKind.StringLiteralToken: 2972case SyntaxKind.Utf8StringLiteralToken: 2973case SyntaxKind.MultiLineRawStringLiteralToken: 2974case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 2975case SyntaxKind.SingleLineRawStringLiteralToken: 2976case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 2977case SyntaxKind.CharacterLiteralToken: 2978case SyntaxKind.TrueKeyword: 2979case SyntaxKind.FalseKeyword: 2980case SyntaxKind.NullKeyword: 2981case SyntaxKind.DefaultKeyword: break; 2990if (token.Kind() != SyntaxKind.FieldKeyword) throw new ArgumentException(nameof(token)); 2996=> SyntaxFactory.FieldExpression(SyntaxFactory.Token(SyntaxKind.FieldKeyword)); 3001if (keyword.Kind() != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); 3002if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3004if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3010=> SyntaxFactory.MakeRefExpression(SyntaxFactory.Token(SyntaxKind.MakeRefKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3015if (keyword.Kind() != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); 3016if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3018if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3024=> SyntaxFactory.RefTypeExpression(SyntaxFactory.Token(SyntaxKind.RefTypeKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3029if (keyword.Kind() != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); 3030if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3032if (comma.Kind() != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); 3034if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3040=> SyntaxFactory.RefValueExpression(SyntaxFactory.Token(SyntaxKind.RefValueKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CommaToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3043public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 3047case SyntaxKind.CheckedExpression: 3048case SyntaxKind.UncheckedExpression: break; 3053case SyntaxKind.CheckedKeyword: 3054case SyntaxKind.UncheckedKeyword: break; 3057if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3059if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3064public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, ExpressionSyntax expression) 3065=> SyntaxFactory.CheckedExpression(kind, SyntaxFactory.Token(GetCheckedExpressionKeywordKind(kind)), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3067private static SyntaxKind GetCheckedExpressionKeywordKind(SyntaxKind kind) 3070SyntaxKind.CheckedExpression => SyntaxKind.CheckedKeyword, 3071SyntaxKind.UncheckedExpression => SyntaxKind.UncheckedKeyword, 3078if (keyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 3079if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3081if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3087=> SyntaxFactory.DefaultExpression(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3092if (keyword.Kind() != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); 3093if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3095if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3101=> SyntaxFactory.TypeOfExpression(SyntaxFactory.Token(SyntaxKind.TypeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3106if (keyword.Kind() != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); 3107if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3109if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3115=> SyntaxFactory.SizeOfExpression(SyntaxFactory.Token(SyntaxKind.SizeOfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3144if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3145if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3151=> SyntaxFactory.ArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3156if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3157if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3163=> SyntaxFactory.BracketedArgumentList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 3170case SyntaxKind.RefKeyword: 3171case SyntaxKind.OutKeyword: 3172case SyntaxKind.InKeyword: 3173case SyntaxKind.None: break; 3188if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 3196if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 3211if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3213if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3220=> SyntaxFactory.CastExpression(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, SyntaxFactory.Token(SyntaxKind.CloseParenToken), expression); 3225if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 3234if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 3241if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 3248=> SyntaxFactory.RefExpression(SyntaxFactory.Token(SyntaxKind.RefKeyword), expression); 3254if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 3260=> SyntaxFactory.ParenthesizedLambdaExpression(attributeLists, modifiers, returnType, parameterList, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), block, expressionBody); 3264=> SyntaxFactory.ParenthesizedLambdaExpression(default, default(SyntaxTokenList), default, SyntaxFactory.ParameterList(), SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), default, default); 3267public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken) 3271case SyntaxKind.ObjectInitializerExpression: 3272case SyntaxKind.CollectionInitializerExpression: 3273case SyntaxKind.ArrayInitializerExpression: 3274case SyntaxKind.ComplexElementInitializerExpression: 3275case SyntaxKind.WithInitializerExpression: break; 3278if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3279if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3284public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SeparatedSyntaxList<ExpressionSyntax> expressions = default) 3285=> SyntaxFactory.InitializerExpression(kind, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expressions, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3290if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3297=> SyntaxFactory.ImplicitObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), argumentList, initializer); 3301=> SyntaxFactory.ImplicitObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.ArgumentList(), default); 3306if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3313=> SyntaxFactory.ObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, argumentList, initializer); 3317=> SyntaxFactory.ObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, default, default); 3323if (withKeyword.Kind() != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 3330=> SyntaxFactory.WithExpression(expression, SyntaxFactory.Token(SyntaxKind.WithKeyword), initializer); 3346if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3347if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3348if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3354=> SyntaxFactory.AnonymousObjectCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), initializers, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3359if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3366=> SyntaxFactory.ArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, initializer); 3370=> SyntaxFactory.ArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), type, default); 3375if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 3376if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3377if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3384=> SyntaxFactory.ImplicitArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), commas, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); 3388=> SyntaxFactory.ImplicitArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); 3393if (stackAllocKeyword.Kind() != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 3400=> SyntaxFactory.StackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), type, initializer); 3404=> SyntaxFactory.StackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), type, default); 3409if (stackAllocKeyword.Kind() != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 3410if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3411if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3418=> SyntaxFactory.ImplicitStackAllocArrayCreationExpression(SyntaxFactory.Token(SyntaxKind.StackAllocKeyword), SyntaxFactory.Token(SyntaxKind.OpenBracketToken), SyntaxFactory.Token(SyntaxKind.CloseBracketToken), initializer); 3423if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3424if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3430=> SyntaxFactory.CollectionExpression(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), elements, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 3442if (operatorToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 3449=> SyntaxFactory.SpreadElement(SyntaxFactory.Token(SyntaxKind.DotDotToken), expression); 3455if (withKeyword.Kind() != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 3463=> SyntaxFactory.WithElement(SyntaxFactory.Token(SyntaxKind.WithKeyword), argumentList ?? SyntaxFactory.ArgumentList()); 3487if (fromKeyword.Kind() != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); 3488if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3489if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 3496=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression); 3500=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression); 3504=> SyntaxFactory.FromClause(SyntaxFactory.Token(SyntaxKind.FromKeyword), default, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.InKeyword), expression); 3509if (letKeyword.Kind() != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); 3510if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3511if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 3518=> SyntaxFactory.LetClause(SyntaxFactory.Token(SyntaxKind.LetKeyword), identifier, SyntaxFactory.Token(SyntaxKind.EqualsToken), expression); 3522=> SyntaxFactory.LetClause(SyntaxFactory.Token(SyntaxKind.LetKeyword), SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.EqualsToken), expression); 3527if (joinKeyword.Kind() != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); 3528if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3529if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 3531if (onKeyword.Kind() != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); 3533if (equalsKeyword.Kind() != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); 3540=> SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), inExpression, SyntaxFactory.Token(SyntaxKind.OnKeyword), leftExpression, SyntaxFactory.Token(SyntaxKind.EqualsKeyword), rightExpression, into); 3544=> SyntaxFactory.JoinClause(SyntaxFactory.Token(SyntaxKind.JoinKeyword), default, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), inExpression, SyntaxFactory.Token(SyntaxKind.OnKeyword), leftExpression, SyntaxFactory.Token(SyntaxKind.EqualsKeyword), rightExpression, default); 3548=> 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); 3553if (intoKeyword.Kind() != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 3554if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3560=> SyntaxFactory.JoinIntoClause(SyntaxFactory.Token(SyntaxKind.IntoKeyword), identifier); 3564=> SyntaxFactory.JoinIntoClause(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier(identifier)); 3569if (whereKeyword.Kind() != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 3576=> SyntaxFactory.WhereClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), condition); 3581if (orderByKeyword.Kind() != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); 3587=> SyntaxFactory.OrderByClause(SyntaxFactory.Token(SyntaxKind.OrderByKeyword), orderings); 3590public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken ascendingOrDescendingKeyword) 3594case SyntaxKind.AscendingOrdering: 3595case SyntaxKind.DescendingOrdering: break; 3601case SyntaxKind.AscendingKeyword: 3602case SyntaxKind.DescendingKeyword: 3603case SyntaxKind.None: break; 3610public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression) 3613private static SyntaxKind GetOrderingAscendingOrDescendingKeywordKind(SyntaxKind kind) 3616SyntaxKind.AscendingOrdering => SyntaxKind.AscendingKeyword, 3617SyntaxKind.DescendingOrdering => SyntaxKind.DescendingKeyword, 3624if (selectKeyword.Kind() != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); 3631=> SyntaxFactory.SelectClause(SyntaxFactory.Token(SyntaxKind.SelectKeyword), expression); 3636if (groupKeyword.Kind() != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); 3638if (byKeyword.Kind() != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); 3645=> SyntaxFactory.GroupClause(SyntaxFactory.Token(SyntaxKind.GroupKeyword), groupExpression, SyntaxFactory.Token(SyntaxKind.ByKeyword), byExpression); 3650if (intoKeyword.Kind() != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 3651if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 3658=> SyntaxFactory.QueryContinuation(SyntaxFactory.Token(SyntaxKind.IntoKeyword), identifier, body); 3662=> SyntaxFactory.QueryContinuation(SyntaxFactory.Token(SyntaxKind.IntoKeyword), SyntaxFactory.Identifier(identifier), body); 3667if (omittedArraySizeExpressionToken.Kind() != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); 3673=> SyntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 3680case SyntaxKind.InterpolatedStringStartToken: 3681case SyntaxKind.InterpolatedVerbatimStringStartToken: 3682case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 3683case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; 3688case SyntaxKind.InterpolatedStringEndToken: 3689case SyntaxKind.InterpolatedRawStringEndToken: break; 3703if (isKeyword.Kind() != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); 3710=> SyntaxFactory.IsPatternExpression(expression, SyntaxFactory.Token(SyntaxKind.IsKeyword), pattern); 3715if (throwKeyword.Kind() != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 3722=> SyntaxFactory.ThrowExpression(SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression); 3727if (whenKeyword.Kind() != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 3734=> SyntaxFactory.WhenClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), condition); 3739if (underscoreToken.Kind() != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 3745=> SyntaxFactory.DiscardPattern(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); 3758if (varKeyword.Kind() != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); 3765=> SyntaxFactory.VarPattern(SyntaxFactory.Token(SyntaxKind.VarKeyword), designation); 3780if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3781if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3787=> SyntaxFactory.PositionalPatternClause(SyntaxFactory.Token(SyntaxKind.OpenParenToken), subpatterns, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3792if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3793if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3799=> SyntaxFactory.PropertyPatternClause(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), subpatterns, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3822if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 3824if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 3830=> SyntaxFactory.ParenthesizedPattern(SyntaxFactory.Token(SyntaxKind.OpenParenToken), pattern, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 3837case SyntaxKind.EqualsEqualsToken: 3838case SyntaxKind.ExclamationEqualsToken: 3839case SyntaxKind.LessThanToken: 3840case SyntaxKind.LessThanEqualsToken: 3841case SyntaxKind.GreaterThanToken: 3842case SyntaxKind.GreaterThanEqualsToken: break; 3857public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 3861case SyntaxKind.OrPattern: 3862case SyntaxKind.AndPattern: break; 3868case SyntaxKind.OrKeyword: 3869case SyntaxKind.AndKeyword: break; 3877public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, PatternSyntax right) 3880private static SyntaxKind GetBinaryPatternOperatorTokenKind(SyntaxKind kind) 3883SyntaxKind.OrPattern => SyntaxKind.OrKeyword, 3884SyntaxKind.AndPattern => SyntaxKind.AndKeyword, 3891if (operatorToken.Kind() != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); 3898=> SyntaxFactory.UnaryPattern(SyntaxFactory.Token(SyntaxKind.NotKeyword), pattern); 3903if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 3904if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 3910=> SyntaxFactory.ListPattern(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), patterns, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), designation); 3914=> SyntaxFactory.ListPattern(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), patterns, SyntaxFactory.Token(SyntaxKind.CloseBracketToken), default); 3919if (dotDotToken.Kind() != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); 3925=> SyntaxFactory.SlicePattern(SyntaxFactory.Token(SyntaxKind.DotDotToken), pattern); 3930if (textToken.Kind() != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); 3936=> SyntaxFactory.InterpolatedStringText(SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); 3941if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3943if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3949=> SyntaxFactory.Interpolation(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expression, alignmentClause, formatClause, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3953=> SyntaxFactory.Interpolation(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), expression, default, default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3965if (formatStringToken.Kind() != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); 3971=> SyntaxFactory.InterpolationFormatClause(colonToken, SyntaxFactory.Token(SyntaxKind.InterpolatedStringTextToken)); 3987if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 3988if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 3994=> SyntaxFactory.Block(attributeLists, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), statements, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 3999=> SyntaxFactory.Block(default, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), statements, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4006if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4010case SyntaxKind.SemicolonToken: 4011case SyntaxKind.None: break; 4034case SyntaxKind.AwaitKeyword: 4035case SyntaxKind.None: break; 4040case SyntaxKind.UsingKeyword: 4041case SyntaxKind.None: break; 4045if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4051=> SyntaxFactory.LocalDeclarationStatement(attributeLists, default, default, modifiers, declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4055=> SyntaxFactory.LocalDeclarationStatement(default, default, default, default(SyntaxTokenList), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4071if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4086if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 4093=> SyntaxFactory.EqualsValueClause(SyntaxFactory.Token(SyntaxKind.EqualsToken), value); 4098if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4105if (underscoreToken.Kind() != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 4111=> SyntaxFactory.DiscardDesignation(SyntaxFactory.Token(SyntaxKind.UnderscoreToken)); 4116if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4117if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4123=> SyntaxFactory.ParenthesizedVariableDesignation(SyntaxFactory.Token(SyntaxKind.OpenParenToken), variables, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4129if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4135=> SyntaxFactory.ExpressionStatement(attributeLists, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4139=> SyntaxFactory.ExpressionStatement(default, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4144if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4150=> SyntaxFactory.EmptyStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4154=> SyntaxFactory.EmptyStatement(default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4159if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4160if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4167=> SyntaxFactory.LabeledStatement(attributeLists, identifier, SyntaxFactory.Token(SyntaxKind.ColonToken), statement); 4171=> SyntaxFactory.LabeledStatement(default, identifier, SyntaxFactory.Token(SyntaxKind.ColonToken), statement); 4175=> SyntaxFactory.LabeledStatement(default, SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.ColonToken), statement); 4178public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 4182case SyntaxKind.GotoStatement: 4183case SyntaxKind.GotoCaseStatement: 4184case SyntaxKind.GotoDefaultStatement: break; 4187if (gotoKeyword.Kind() != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); 4190case SyntaxKind.CaseKeyword: 4191case SyntaxKind.DefaultKeyword: 4192case SyntaxKind.None: break; 4195if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4200public static GotoStatementSyntax GotoStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken caseOrDefaultKeyword, ExpressionSyntax? expression) 4201=> SyntaxFactory.GotoStatement(kind, attributeLists, SyntaxFactory.Token(SyntaxKind.GotoKeyword), caseOrDefaultKeyword, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4205public static GotoStatementSyntax GotoStatement(SyntaxKind kind, ExpressionSyntax? expression = default) 4206=> SyntaxFactory.GotoStatement(kind, default, SyntaxFactory.Token(SyntaxKind.GotoKeyword), default, expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4212if (breakKeyword.Kind() != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); 4213if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4219=> SyntaxFactory.BreakStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.BreakKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4223=> SyntaxFactory.BreakStatement(default, SyntaxFactory.Token(SyntaxKind.BreakKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4228if (continueKeyword.Kind() != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); 4229if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4235=> SyntaxFactory.ContinueStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ContinueKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4239=> SyntaxFactory.ContinueStatement(default, SyntaxFactory.Token(SyntaxKind.ContinueKeyword), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4244if (returnKeyword.Kind() != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); 4245if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4251=> SyntaxFactory.ReturnStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ReturnKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4256=> SyntaxFactory.ReturnStatement(default, SyntaxFactory.Token(SyntaxKind.ReturnKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4262if (throwKeyword.Kind() != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 4263if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4269=> SyntaxFactory.ThrowStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4274=> SyntaxFactory.ThrowStatement(default, SyntaxFactory.Token(SyntaxKind.ThrowKeyword), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4278public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 4282case SyntaxKind.YieldReturnStatement: 4283case SyntaxKind.YieldBreakStatement: break; 4286if (yieldKeyword.Kind() != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); 4289case SyntaxKind.ReturnKeyword: 4290case SyntaxKind.BreakKeyword: break; 4293if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4298public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, ExpressionSyntax? expression) 4299=> SyntaxFactory.YieldStatement(kind, attributeLists, SyntaxFactory.Token(SyntaxKind.YieldKeyword), SyntaxFactory.Token(GetYieldStatementReturnOrBreakKeywordKind(kind)), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4303public static YieldStatementSyntax YieldStatement(SyntaxKind kind, ExpressionSyntax? expression = default) 4304=> SyntaxFactory.YieldStatement(kind, default, SyntaxFactory.Token(SyntaxKind.YieldKeyword), SyntaxFactory.Token(GetYieldStatementReturnOrBreakKeywordKind(kind)), expression, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4307private static SyntaxKind GetYieldStatementReturnOrBreakKeywordKind(SyntaxKind kind) 4310SyntaxKind.YieldReturnStatement => SyntaxKind.ReturnKeyword, 4311SyntaxKind.YieldBreakStatement => SyntaxKind.BreakKeyword, 4318if (whileKeyword.Kind() != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 4319if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4321if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4328=> SyntaxFactory.WhileStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4332=> SyntaxFactory.WhileStatement(default, SyntaxFactory.Token(SyntaxKind.WhileKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4337if (doKeyword.Kind() != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); 4339if (whileKeyword.Kind() != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 4340if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4342if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4343if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4349=> 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)); 4353=> 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)); 4358if (forKeyword.Kind() != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); 4359if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4360if (firstSemicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); 4361if (secondSemicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); 4362if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4369=> 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); 4373=> 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); 4380case SyntaxKind.AwaitKeyword: 4381case SyntaxKind.None: break; 4384if (forEachKeyword.Kind() != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 4385if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4387if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4388if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 4390if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4397=> SyntaxFactory.ForEachStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4401=> SyntaxFactory.ForEachStatement(default, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4405=> 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); 4412case SyntaxKind.AwaitKeyword: 4413case SyntaxKind.None: break; 4416if (forEachKeyword.Kind() != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 4417if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4419if (inKeyword.Kind() != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 4421if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4428=> SyntaxFactory.ForEachVariableStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), variable, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4432=> SyntaxFactory.ForEachVariableStatement(default, default, SyntaxFactory.Token(SyntaxKind.ForEachKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), variable, SyntaxFactory.Token(SyntaxKind.InKeyword), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4439case SyntaxKind.AwaitKeyword: 4440case SyntaxKind.None: break; 4443if (usingKeyword.Kind() != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 4444if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4445if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4452=> SyntaxFactory.UsingStatement(attributeLists, default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4456=> SyntaxFactory.UsingStatement(default, default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), default, default, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4461if (fixedKeyword.Kind() != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); 4462if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4464if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4471=> SyntaxFactory.FixedStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.FixedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4475=> SyntaxFactory.FixedStatement(default, SyntaxFactory.Token(SyntaxKind.FixedKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), declaration, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4478public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block) 4482case SyntaxKind.CheckedStatement: 4483case SyntaxKind.UncheckedStatement: break; 4488case SyntaxKind.CheckedKeyword: 4489case SyntaxKind.UncheckedKeyword: break; 4497public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, BlockSyntax block) 4502public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, BlockSyntax? block = default) 4506private static SyntaxKind GetCheckedStatementKeywordKind(SyntaxKind kind) 4509SyntaxKind.CheckedStatement => SyntaxKind.CheckedKeyword, 4510SyntaxKind.UncheckedStatement => SyntaxKind.UncheckedKeyword, 4517if (unsafeKeyword.Kind() != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); 4524=> SyntaxFactory.UnsafeStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), block); 4529=> SyntaxFactory.UnsafeStatement(default, SyntaxFactory.Token(SyntaxKind.UnsafeKeyword), block ?? SyntaxFactory.Block()); 4535if (lockKeyword.Kind() != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); 4536if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4538if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4545=> SyntaxFactory.LockStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.LockKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4549=> SyntaxFactory.LockStatement(default, SyntaxFactory.Token(SyntaxKind.LockKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), expression, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement); 4554if (ifKeyword.Kind() != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 4555if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4557if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4564=> SyntaxFactory.IfStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.IfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement, @else); 4568=> SyntaxFactory.IfStatement(default, SyntaxFactory.Token(SyntaxKind.IfKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), condition, SyntaxFactory.Token(SyntaxKind.CloseParenToken), statement, default); 4573if (elseKeyword.Kind() != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 4580=> SyntaxFactory.ElseClause(SyntaxFactory.Token(SyntaxKind.ElseKeyword), statement); 4585if (switchKeyword.Kind() != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 4588case SyntaxKind.OpenParenToken: 4589case SyntaxKind.None: break; 4595case SyntaxKind.CloseParenToken: 4596case SyntaxKind.None: break; 4599if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 4600if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 4617if (keyword.Kind() != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 4619if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4625=> SyntaxFactory.CasePatternSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), pattern, whenClause, colonToken); 4629=> SyntaxFactory.CasePatternSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), pattern, default, colonToken); 4634if (keyword.Kind() != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 4636if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4642=> SyntaxFactory.CaseSwitchLabel(SyntaxFactory.Token(SyntaxKind.CaseKeyword), value, colonToken); 4647if (keyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 4648if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4654=> SyntaxFactory.DefaultSwitchLabel(SyntaxFactory.Token(SyntaxKind.DefaultKeyword), colonToken); 4660if (switchKeyword.Kind() != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 4661if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 4662if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 4668=> SyntaxFactory.SwitchExpression(governingExpression, SyntaxFactory.Token(SyntaxKind.SwitchKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), arms, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4672=> SyntaxFactory.SwitchExpression(governingExpression, SyntaxFactory.Token(SyntaxKind.SwitchKeyword), SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 4678if (equalsGreaterThanToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); 4685=> SyntaxFactory.SwitchExpressionArm(pattern, whenClause, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); 4689=> SyntaxFactory.SwitchExpressionArm(pattern, default, SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); 4694if (tryKeyword.Kind() != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); 4701=> SyntaxFactory.TryStatement(attributeLists, SyntaxFactory.Token(SyntaxKind.TryKeyword), block, catches, @finally); 4706=> SyntaxFactory.TryStatement(default, SyntaxFactory.Token(SyntaxKind.TryKeyword), SyntaxFactory.Block(), catches, default); 4712if (catchKeyword.Kind() != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); 4719=> SyntaxFactory.CatchClause(SyntaxFactory.Token(SyntaxKind.CatchKeyword), declaration, filter, block); 4723=> SyntaxFactory.CatchClause(SyntaxFactory.Token(SyntaxKind.CatchKeyword), default, default, SyntaxFactory.Block()); 4728if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4732case SyntaxKind.IdentifierToken: 4733case SyntaxKind.None: break; 4736if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4742=> SyntaxFactory.CatchDeclaration(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, identifier, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4746=> SyntaxFactory.CatchDeclaration(SyntaxFactory.Token(SyntaxKind.OpenParenToken), type, default, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4751if (whenKeyword.Kind() != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 4752if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4754if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4760=> SyntaxFactory.CatchFilterClause(SyntaxFactory.Token(SyntaxKind.WhenKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), filterExpression, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4765if (finallyKeyword.Kind() != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); 4772=> SyntaxFactory.FinallyClause(SyntaxFactory.Token(SyntaxKind.FinallyKeyword), block ?? SyntaxFactory.Block()); 4777if (endOfFileToken.Kind() != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); 4783=> SyntaxFactory.CompilationUnit(externs, usings, attributeLists, members, SyntaxFactory.Token(SyntaxKind.EndOfFileToken)); 4787=> SyntaxFactory.CompilationUnit(default, default, default, default, SyntaxFactory.Token(SyntaxKind.EndOfFileToken)); 4792if (externKeyword.Kind() != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); 4793if (aliasKeyword.Kind() != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); 4794if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4795if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4801=> SyntaxFactory.ExternAliasDirective(SyntaxFactory.Token(SyntaxKind.ExternKeyword), SyntaxFactory.Token(SyntaxKind.AliasKeyword), identifier, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4805=> SyntaxFactory.ExternAliasDirective(SyntaxFactory.Token(SyntaxKind.ExternKeyword), SyntaxFactory.Token(SyntaxKind.AliasKeyword), SyntaxFactory.Identifier(identifier), SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4812case SyntaxKind.GlobalKeyword: 4813case SyntaxKind.None: break; 4816if (usingKeyword.Kind() != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 4819case SyntaxKind.StaticKeyword: 4820case SyntaxKind.None: break; 4825case SyntaxKind.UnsafeKeyword: 4826case SyntaxKind.None: break; 4830if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4836=> SyntaxFactory.UsingDirective(default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), default, default, alias, namespaceOrType, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4840=> SyntaxFactory.UsingDirective(default, SyntaxFactory.Token(SyntaxKind.UsingKeyword), default, default, default, namespaceOrType, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 4845if (namespaceKeyword.Kind() != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 4847if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 4848if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 4851case SyntaxKind.SemicolonToken: 4852case SyntaxKind.None: break; 4860=> SyntaxFactory.NamespaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), externs, usings, members, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 4864=> SyntaxFactory.NamespaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.OpenBraceToken), default, default, default, SyntaxFactory.Token(SyntaxKind.CloseBraceToken), default); 4869if (namespaceKeyword.Kind() != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 4871if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 4877=> SyntaxFactory.FileScopedNamespaceDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken), externs, usings, members); 4881=> SyntaxFactory.FileScopedNamespaceDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.NamespaceKeyword), name, SyntaxFactory.Token(SyntaxKind.SemicolonToken), default, default, default); 4886if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 4887if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 4893=> SyntaxFactory.AttributeList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), target, attributes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 4897=> SyntaxFactory.AttributeList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), default, attributes, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 4902if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 4908=> SyntaxFactory.AttributeTargetSpecifier(identifier, SyntaxFactory.Token(SyntaxKind.ColonToken)); 4924if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 4925if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 4931=> SyntaxFactory.AttributeArgumentList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), arguments, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 4948if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 4954=> SyntaxFactory.NameEquals(name, SyntaxFactory.Token(SyntaxKind.EqualsToken)); 4958=> SyntaxFactory.NameEquals(SyntaxFactory.IdentifierName(name), SyntaxFactory.Token(SyntaxKind.EqualsToken)); 4963if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 4964if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 4970=> SyntaxFactory.TypeParameterList(SyntaxFactory.Token(SyntaxKind.LessThanToken), parameters, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 4977case SyntaxKind.InKeyword: 4978case SyntaxKind.OutKeyword: 4979case SyntaxKind.None: break; 4982if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 4997if (keyword.Kind() != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); 4998if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5001case SyntaxKind.OpenBraceToken: 5002case SyntaxKind.None: break; 5007case SyntaxKind.CloseBraceToken: 5008case SyntaxKind.None: break; 5013case SyntaxKind.SemicolonToken: 5014case SyntaxKind.None: break; 5022public static StructDeclarationSyntax StructDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken openBraceToken, SyntaxList<MemberDeclarationSyntax> members, SyntaxToken closeBraceToken, SyntaxToken semicolonToken) 5026case SyntaxKind.StructDeclaration: 5027case SyntaxKind.UnionDeclaration: break; 5032case SyntaxKind.StructKeyword: 5033case SyntaxKind.UnionKeyword: break; 5036if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5039case SyntaxKind.OpenBraceToken: 5040case SyntaxKind.None: break; 5045case SyntaxKind.CloseBraceToken: 5046case SyntaxKind.None: break; 5051case SyntaxKind.SemicolonToken: 5052case SyntaxKind.None: break; 5058private static SyntaxKind GetStructDeclarationKeywordKind(SyntaxKind kind) 5061SyntaxKind.StructDeclaration => SyntaxKind.StructKeyword, 5062SyntaxKind.UnionDeclaration => SyntaxKind.UnionKeyword, 5069if (keyword.Kind() != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); 5070if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5073case SyntaxKind.OpenBraceToken: 5074case SyntaxKind.None: break; 5079case SyntaxKind.CloseBraceToken: 5080case SyntaxKind.None: break; 5085case SyntaxKind.SemicolonToken: 5086case SyntaxKind.None: break; 5093public 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) 5097case SyntaxKind.RecordDeclaration: 5098case SyntaxKind.RecordStructDeclaration: break; 5103case SyntaxKind.ClassKeyword: 5104case SyntaxKind.StructKeyword: 5105case SyntaxKind.None: break; 5108if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5111case SyntaxKind.OpenBraceToken: 5112case SyntaxKind.None: break; 5117case SyntaxKind.CloseBraceToken: 5118case SyntaxKind.None: break; 5123case SyntaxKind.SemicolonToken: 5124case SyntaxKind.None: break; 5131public 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) 5135public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxToken keyword, SyntaxToken identifier) 5139public static RecordDeclarationSyntax RecordDeclaration(SyntaxKind kind, SyntaxToken keyword, string identifier) 5142private static SyntaxKind GetRecordDeclarationClassOrStructKeywordKind(SyntaxKind kind) 5145SyntaxKind.RecordDeclaration => SyntaxKind.ClassKeyword, 5146SyntaxKind.RecordStructDeclaration => SyntaxKind.StructKeyword, 5153if (enumKeyword.Kind() != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); 5154if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5157case SyntaxKind.OpenBraceToken: 5158case SyntaxKind.None: break; 5163case SyntaxKind.CloseBraceToken: 5164case SyntaxKind.None: break; 5169case SyntaxKind.SemicolonToken: 5170case SyntaxKind.None: break; 5179if (delegateKeyword.Kind() != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 5181if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5183if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 5189=> SyntaxFactory.DelegateDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, identifier, typeParameterList, parameterList, constraintClauses, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5193=> SyntaxFactory.DelegateDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, identifier, default, SyntaxFactory.ParameterList(), default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5197=> SyntaxFactory.DelegateDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.DelegateKeyword), returnType, SyntaxFactory.Identifier(identifier), default, SyntaxFactory.ParameterList(), default, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5202if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5217if (keyword.Kind() != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(keyword)); 5220case SyntaxKind.OpenBraceToken: 5221case SyntaxKind.None: break; 5226case SyntaxKind.CloseBraceToken: 5227case SyntaxKind.None: break; 5232case SyntaxKind.SemicolonToken: 5233case SyntaxKind.None: break; 5241=> SyntaxFactory.ExtensionBlockDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), typeParameterList, parameterList, constraintClauses, default, members, default, default); 5245=> SyntaxFactory.ExtensionBlockDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), default, default, default, default, default, default, default); 5250if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 5256=> SyntaxFactory.BaseList(SyntaxFactory.Token(SyntaxKind.ColonToken), types); 5280if (whereKeyword.Kind() != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 5282if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 5288=> SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), name, SyntaxFactory.Token(SyntaxKind.ColonToken), constraints); 5292=> SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), name, SyntaxFactory.Token(SyntaxKind.ColonToken), default); 5296=> SyntaxFactory.TypeParameterConstraintClause(SyntaxFactory.Token(SyntaxKind.WhereKeyword), SyntaxFactory.IdentifierName(name), SyntaxFactory.Token(SyntaxKind.ColonToken), default); 5301if (newKeyword.Kind() != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 5302if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 5303if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 5309=> SyntaxFactory.ConstructorConstraint(SyntaxFactory.Token(SyntaxKind.NewKeyword), SyntaxFactory.Token(SyntaxKind.OpenParenToken), SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 5312public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken questionToken) 5316case SyntaxKind.ClassConstraint: 5317case SyntaxKind.StructConstraint: break; 5322case SyntaxKind.ClassKeyword: 5323case SyntaxKind.StructKeyword: break; 5328case SyntaxKind.QuestionToken: 5329case SyntaxKind.None: break; 5336public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind) 5339private static SyntaxKind GetClassOrStructConstraintClassOrStructKeywordKind(SyntaxKind kind) 5342SyntaxKind.ClassConstraint => SyntaxKind.ClassKeyword, 5343SyntaxKind.StructConstraint => SyntaxKind.StructKeyword, 5357if (defaultKeyword.Kind() != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); 5363=> SyntaxFactory.DefaultConstraint(SyntaxFactory.Token(SyntaxKind.DefaultKeyword)); 5368if (allowsKeyword.Kind() != SyntaxKind.AllowsKeyword) throw new ArgumentException(nameof(allowsKeyword)); 5374=> SyntaxFactory.AllowsConstraintClause(SyntaxFactory.Token(SyntaxKind.AllowsKeyword), constraints); 5379if (refKeyword.Kind() != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 5380if (structKeyword.Kind() != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(structKeyword)); 5386=> SyntaxFactory.RefStructConstraint(SyntaxFactory.Token(SyntaxKind.RefKeyword), SyntaxFactory.Token(SyntaxKind.StructKeyword)); 5392if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 5398=> SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5402=> SyntaxFactory.FieldDeclaration(default, default(SyntaxTokenList), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5407if (eventKeyword.Kind() != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 5409if (semicolonToken.Kind() != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 5415=> SyntaxFactory.EventFieldDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EventKeyword), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5419=> SyntaxFactory.EventFieldDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), declaration, SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 5425if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 5431=> SyntaxFactory.ExplicitInterfaceSpecifier(name, SyntaxFactory.Token(SyntaxKind.DotToken)); 5437if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5441case SyntaxKind.SemicolonToken: 5442case SyntaxKind.None: break; 5464if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 5467case SyntaxKind.CheckedKeyword: 5468case SyntaxKind.None: break; 5473case SyntaxKind.PlusToken: 5474case SyntaxKind.MinusToken: 5475case SyntaxKind.ExclamationToken: 5476case SyntaxKind.TildeToken: 5477case SyntaxKind.PlusPlusToken: 5478case SyntaxKind.MinusMinusToken: 5479case SyntaxKind.AsteriskToken: 5480case SyntaxKind.SlashToken: 5481case SyntaxKind.PercentToken: 5482case SyntaxKind.LessThanLessThanToken: 5483case SyntaxKind.GreaterThanGreaterThanToken: 5484case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 5485case SyntaxKind.BarToken: 5486case SyntaxKind.AmpersandToken: 5487case SyntaxKind.CaretToken: 5488case SyntaxKind.EqualsEqualsToken: 5489case SyntaxKind.ExclamationEqualsToken: 5490case SyntaxKind.LessThanToken: 5491case SyntaxKind.LessThanEqualsToken: 5492case SyntaxKind.GreaterThanToken: 5493case SyntaxKind.GreaterThanEqualsToken: 5494case SyntaxKind.FalseKeyword: 5495case SyntaxKind.TrueKeyword: 5496case SyntaxKind.IsKeyword: 5497case SyntaxKind.PlusEqualsToken: 5498case SyntaxKind.MinusEqualsToken: 5499case SyntaxKind.AsteriskEqualsToken: 5500case SyntaxKind.SlashEqualsToken: 5501case SyntaxKind.PercentEqualsToken: 5502case SyntaxKind.AmpersandEqualsToken: 5503case SyntaxKind.BarEqualsToken: 5504case SyntaxKind.CaretEqualsToken: 5505case SyntaxKind.LessThanLessThanEqualsToken: 5506case SyntaxKind.GreaterThanGreaterThanEqualsToken: 5507case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 5513case SyntaxKind.SemicolonToken: 5514case SyntaxKind.None: break; 5522=> SyntaxFactory.OperatorDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, parameterList, body, expressionBody, default); 5526=> SyntaxFactory.OperatorDeclaration(default, default(SyntaxTokenList), returnType, default, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, SyntaxFactory.ParameterList(), default, default, default); 5533case SyntaxKind.ImplicitKeyword: 5534case SyntaxKind.ExplicitKeyword: break; 5537if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 5540case SyntaxKind.CheckedKeyword: 5541case SyntaxKind.None: break; 5548case SyntaxKind.SemicolonToken: 5549case SyntaxKind.None: break; 5557=> SyntaxFactory.ConversionOperatorDeclaration(attributeLists, modifiers, implicitOrExplicitKeyword, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, parameterList, body, expressionBody, default); 5561=> SyntaxFactory.ConversionOperatorDeclaration(default, default(SyntaxTokenList), implicitOrExplicitKeyword, default, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, SyntaxFactory.ParameterList(), default, default, default); 5566if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5570case SyntaxKind.SemicolonToken: 5571case SyntaxKind.None: break; 5590public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 5594case SyntaxKind.BaseConstructorInitializer: 5595case SyntaxKind.ThisConstructorInitializer: break; 5598if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 5601case SyntaxKind.BaseKeyword: 5602case SyntaxKind.ThisKeyword: break; 5610public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, ArgumentListSyntax? argumentList = default) 5611=> SyntaxFactory.ConstructorInitializer(kind, SyntaxFactory.Token(SyntaxKind.ColonToken), SyntaxFactory.Token(GetConstructorInitializerThisOrBaseKeywordKind(kind)), argumentList ?? SyntaxFactory.ArgumentList()); 5613private static SyntaxKind GetConstructorInitializerThisOrBaseKeywordKind(SyntaxKind kind) 5616SyntaxKind.BaseConstructorInitializer => SyntaxKind.BaseKeyword, 5617SyntaxKind.ThisConstructorInitializer => SyntaxKind.ThisKeyword, 5624if (tildeToken.Kind() != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); 5625if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5629case SyntaxKind.SemicolonToken: 5630case SyntaxKind.None: break; 5638=> SyntaxFactory.DestructorDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.TildeToken), identifier, parameterList, body, expressionBody, default); 5642=> SyntaxFactory.DestructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.TildeToken), identifier, SyntaxFactory.ParameterList(), default, default, default); 5646=> SyntaxFactory.DestructorDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.TildeToken), SyntaxFactory.Identifier(identifier), SyntaxFactory.ParameterList(), default, default, default); 5652if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5655case SyntaxKind.SemicolonToken: 5656case SyntaxKind.None: break; 5677if (arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 5684=> SyntaxFactory.ArrowExpressionClause(SyntaxFactory.Token(SyntaxKind.EqualsGreaterThanToken), expression); 5689if (eventKeyword.Kind() != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 5691if (identifier.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 5694case SyntaxKind.SemicolonToken: 5695case SyntaxKind.None: break; 5703=> SyntaxFactory.EventDeclaration(attributeLists, modifiers, SyntaxFactory.Token(SyntaxKind.EventKeyword), type, explicitInterfaceSpecifier, identifier, accessorList, default); 5707=> SyntaxFactory.EventDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), type, default, identifier, default, default); 5711=> SyntaxFactory.EventDeclaration(default, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.EventKeyword), type, default, SyntaxFactory.Identifier(identifier), default, default); 5717if (thisKeyword.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 5721case SyntaxKind.SemicolonToken: 5722case SyntaxKind.None: break; 5730=> SyntaxFactory.IndexerDeclaration(attributeLists, modifiers, type, explicitInterfaceSpecifier, SyntaxFactory.Token(SyntaxKind.ThisKeyword), parameterList, accessorList, expressionBody, default); 5734=> SyntaxFactory.IndexerDeclaration(default, default(SyntaxTokenList), type, default, SyntaxFactory.Token(SyntaxKind.ThisKeyword), SyntaxFactory.BracketedParameterList(), default, default, default); 5739if (openBraceToken.Kind() != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 5740if (closeBraceToken.Kind() != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 5746=> SyntaxFactory.AccessorList(SyntaxFactory.Token(SyntaxKind.OpenBraceToken), accessors, SyntaxFactory.Token(SyntaxKind.CloseBraceToken)); 5749public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken) 5753case SyntaxKind.GetAccessorDeclaration: 5754case SyntaxKind.SetAccessorDeclaration: 5755case SyntaxKind.InitAccessorDeclaration: 5756case SyntaxKind.AddAccessorDeclaration: 5757case SyntaxKind.RemoveAccessorDeclaration: 5758case SyntaxKind.UnknownAccessorDeclaration: break; 5763case SyntaxKind.GetKeyword: 5764case SyntaxKind.SetKeyword: 5765case SyntaxKind.InitKeyword: 5766case SyntaxKind.AddKeyword: 5767case SyntaxKind.RemoveKeyword: 5768case SyntaxKind.IdentifierToken: break; 5773case SyntaxKind.SemicolonToken: 5774case SyntaxKind.None: break; 5781public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody) 5785public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind) 5788private static SyntaxKind GetAccessorDeclarationKeywordKind(SyntaxKind kind) 5791SyntaxKind.GetAccessorDeclaration => SyntaxKind.GetKeyword, 5792SyntaxKind.SetAccessorDeclaration => SyntaxKind.SetKeyword, 5793SyntaxKind.InitAccessorDeclaration => SyntaxKind.InitKeyword, 5794SyntaxKind.AddAccessorDeclaration => SyntaxKind.AddKeyword, 5795SyntaxKind.RemoveAccessorDeclaration => SyntaxKind.RemoveKeyword, 5796SyntaxKind.UnknownAccessorDeclaration => SyntaxKind.IdentifierToken, 5803if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 5804if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 5810=> SyntaxFactory.ParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 5815if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 5816if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 5822=> SyntaxFactory.BracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 5829case SyntaxKind.IdentifierToken: 5830case SyntaxKind.ArgListKeyword: 5831case SyntaxKind.None: break; 5871public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment) 5875case SyntaxKind.SingleLineDocumentationCommentTrivia: 5876case SyntaxKind.MultiLineDocumentationCommentTrivia: break; 5879if (endOfComment.Kind() != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); 5884public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, SyntaxList<XmlNodeSyntax> content = default) 5885=> SyntaxFactory.DocumentationCommentTrivia(kind, content, SyntaxFactory.Token(SyntaxKind.EndOfDocumentationCommentToken)); 5898if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 5905=> SyntaxFactory.QualifiedCref(container, SyntaxFactory.Token(SyntaxKind.DotToken), member); 5921if (extensionKeyword.Kind() != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(extensionKeyword)); 5923if (dotToken.Kind() != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 5930=> SyntaxFactory.ExtensionMemberCref(SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), typeArgumentList, parameters, SyntaxFactory.Token(SyntaxKind.DotToken), member); 5934=> SyntaxFactory.ExtensionMemberCref(SyntaxFactory.Token(SyntaxKind.ExtensionKeyword), default, SyntaxFactory.CrefParameterList(), SyntaxFactory.Token(SyntaxKind.DotToken), member); 5939if (thisKeyword.Kind() != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 5945=> SyntaxFactory.IndexerMemberCref(SyntaxFactory.Token(SyntaxKind.ThisKeyword), parameters); 5950if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 5953case SyntaxKind.CheckedKeyword: 5954case SyntaxKind.None: break; 5959case SyntaxKind.PlusToken: 5960case SyntaxKind.MinusToken: 5961case SyntaxKind.ExclamationToken: 5962case SyntaxKind.TildeToken: 5963case SyntaxKind.PlusPlusToken: 5964case SyntaxKind.MinusMinusToken: 5965case SyntaxKind.AsteriskToken: 5966case SyntaxKind.SlashToken: 5967case SyntaxKind.PercentToken: 5968case SyntaxKind.LessThanLessThanToken: 5969case SyntaxKind.GreaterThanGreaterThanToken: 5970case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 5971case SyntaxKind.BarToken: 5972case SyntaxKind.AmpersandToken: 5973case SyntaxKind.CaretToken: 5974case SyntaxKind.EqualsEqualsToken: 5975case SyntaxKind.ExclamationEqualsToken: 5976case SyntaxKind.LessThanToken: 5977case SyntaxKind.LessThanEqualsToken: 5978case SyntaxKind.GreaterThanToken: 5979case SyntaxKind.GreaterThanEqualsToken: 5980case SyntaxKind.FalseKeyword: 5981case SyntaxKind.TrueKeyword: 5982case SyntaxKind.PlusEqualsToken: 5983case SyntaxKind.MinusEqualsToken: 5984case SyntaxKind.AsteriskEqualsToken: 5985case SyntaxKind.SlashEqualsToken: 5986case SyntaxKind.PercentEqualsToken: 5987case SyntaxKind.AmpersandEqualsToken: 5988case SyntaxKind.BarEqualsToken: 5989case SyntaxKind.CaretEqualsToken: 5990case SyntaxKind.LessThanLessThanEqualsToken: 5991case SyntaxKind.GreaterThanGreaterThanEqualsToken: 5992case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 6000=> SyntaxFactory.OperatorMemberCref(SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, parameters); 6004=> SyntaxFactory.OperatorMemberCref(SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, operatorToken, default); 6011case SyntaxKind.ImplicitKeyword: 6012case SyntaxKind.ExplicitKeyword: break; 6015if (operatorKeyword.Kind() != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 6018case SyntaxKind.CheckedKeyword: 6019case SyntaxKind.None: break; 6028=> SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, parameters); 6032=> SyntaxFactory.ConversionOperatorMemberCref(implicitOrExplicitKeyword, SyntaxFactory.Token(SyntaxKind.OperatorKeyword), default, type, default); 6037if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 6038if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 6044=> SyntaxFactory.CrefParameterList(SyntaxFactory.Token(SyntaxKind.OpenParenToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 6049if (openBracketToken.Kind() != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 6050if (closeBracketToken.Kind() != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 6056=> SyntaxFactory.CrefBracketedParameterList(SyntaxFactory.Token(SyntaxKind.OpenBracketToken), parameters, SyntaxFactory.Token(SyntaxKind.CloseBracketToken)); 6063case SyntaxKind.RefKeyword: 6064case SyntaxKind.OutKeyword: 6065case SyntaxKind.InKeyword: 6066case SyntaxKind.None: break; 6071case SyntaxKind.ReadOnlyKeyword: 6072case SyntaxKind.None: break; 6102if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 6104if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 6110=> SyntaxFactory.XmlElementStartTag(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, attributes, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 6114=> SyntaxFactory.XmlElementStartTag(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, default, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 6119if (lessThanSlashToken.Kind() != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); 6121if (greaterThanToken.Kind() != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 6127=> SyntaxFactory.XmlElementEndTag(SyntaxFactory.Token(SyntaxKind.LessThanSlashToken), name, SyntaxFactory.Token(SyntaxKind.GreaterThanToken)); 6132if (lessThanToken.Kind() != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 6134if (slashGreaterThanToken.Kind() != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); 6140=> SyntaxFactory.XmlEmptyElement(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, attributes, SyntaxFactory.Token(SyntaxKind.SlashGreaterThanToken)); 6144=> SyntaxFactory.XmlEmptyElement(SyntaxFactory.Token(SyntaxKind.LessThanToken), name, default, SyntaxFactory.Token(SyntaxKind.SlashGreaterThanToken)); 6149if (localName.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); 6164if (prefix.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); 6165if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 6171=> SyntaxFactory.XmlPrefix(prefix, SyntaxFactory.Token(SyntaxKind.ColonToken)); 6175=> SyntaxFactory.XmlPrefix(SyntaxFactory.Identifier(prefix), SyntaxFactory.Token(SyntaxKind.ColonToken)); 6181if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 6184case SyntaxKind.SingleQuoteToken: 6185case SyntaxKind.DoubleQuoteToken: break; 6190case SyntaxKind.SingleQuoteToken: 6191case SyntaxKind.DoubleQuoteToken: break; 6199=> SyntaxFactory.XmlTextAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, textTokens, endQuoteToken); 6203=> SyntaxFactory.XmlTextAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, default(SyntaxTokenList), endQuoteToken); 6209if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 6212case SyntaxKind.SingleQuoteToken: 6213case SyntaxKind.DoubleQuoteToken: break; 6219case SyntaxKind.SingleQuoteToken: 6220case SyntaxKind.DoubleQuoteToken: break; 6228=> SyntaxFactory.XmlCrefAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, cref, endQuoteToken); 6234if (equalsToken.Kind() != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 6237case SyntaxKind.SingleQuoteToken: 6238case SyntaxKind.DoubleQuoteToken: break; 6244case SyntaxKind.SingleQuoteToken: 6245case SyntaxKind.DoubleQuoteToken: break; 6253=> SyntaxFactory.XmlNameAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, identifier, endQuoteToken); 6257=> SyntaxFactory.XmlNameAttribute(name, SyntaxFactory.Token(SyntaxKind.EqualsToken), startQuoteToken, SyntaxFactory.IdentifierName(identifier), endQuoteToken); 6272if (startCDataToken.Kind() != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); 6273if (endCDataToken.Kind() != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); 6279=> SyntaxFactory.XmlCDataSection(SyntaxFactory.Token(SyntaxKind.XmlCDataStartToken), textTokens, SyntaxFactory.Token(SyntaxKind.XmlCDataEndToken)); 6284if (startProcessingInstructionToken.Kind() != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); 6286if (endProcessingInstructionToken.Kind() != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); 6292=> SyntaxFactory.XmlProcessingInstruction(SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionStartToken), name, textTokens, SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionEndToken)); 6296=> SyntaxFactory.XmlProcessingInstruction(SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionStartToken), name, default(SyntaxTokenList), SyntaxFactory.Token(SyntaxKind.XmlProcessingInstructionEndToken)); 6301if (lessThanExclamationMinusMinusToken.Kind() != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); 6302if (minusMinusGreaterThanToken.Kind() != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); 6308=> SyntaxFactory.XmlComment(SyntaxFactory.Token(SyntaxKind.XmlCommentStartToken), textTokens, SyntaxFactory.Token(SyntaxKind.XmlCommentEndToken)); 6313if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6314if (ifKeyword.Kind() != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 6316if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6322=> SyntaxFactory.IfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.IfKeyword), condition, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken, conditionValue); 6327if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6328if (elifKeyword.Kind() != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); 6330if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6336=> SyntaxFactory.ElifDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElifKeyword), condition, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken, conditionValue); 6341if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6342if (elseKeyword.Kind() != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 6343if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6349=> SyntaxFactory.ElseDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ElseKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive, branchTaken); 6354if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6355if (endIfKeyword.Kind() != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); 6356if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6362=> SyntaxFactory.EndIfDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndIfKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6367if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6368if (regionKeyword.Kind() != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); 6369if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6375=> SyntaxFactory.RegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.RegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6380if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6381if (endRegionKeyword.Kind() != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); 6382if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6388=> SyntaxFactory.EndRegionDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.EndRegionKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6393if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6394if (errorKeyword.Kind() != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); 6395if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6401=> SyntaxFactory.ErrorDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ErrorKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6406if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6407if (warningKeyword.Kind() != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 6408if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6414=> SyntaxFactory.WarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.WarningKeyword), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6419if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6420if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6426=> SyntaxFactory.BadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), identifier, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6431if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6432if (defineKeyword.Kind() != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); 6433if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 6434if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6440=> SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.DefineKeyword), name, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6444=> SyntaxFactory.DefineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.DefineKeyword), SyntaxFactory.Identifier(name), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6449if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6450if (undefKeyword.Kind() != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); 6451if (name.Kind() != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 6452if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6458=> SyntaxFactory.UndefDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.UndefKeyword), name, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6462=> SyntaxFactory.UndefDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.UndefKeyword), SyntaxFactory.Identifier(name), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6467if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6468if (lineKeyword.Kind() != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 6471case SyntaxKind.NumericLiteralToken: 6472case SyntaxKind.DefaultKeyword: 6473case SyntaxKind.HiddenKeyword: break; 6478case SyntaxKind.StringLiteralToken: 6479case SyntaxKind.None: break; 6482if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6488=> SyntaxFactory.LineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), line, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6492=> SyntaxFactory.LineDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), line, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6497if (openParenToken.Kind() != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 6498if (line.Kind() != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); 6499if (commaToken.Kind() != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); 6500if (character.Kind() != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); 6501if (closeParenToken.Kind() != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 6507=> SyntaxFactory.LineDirectivePosition(SyntaxFactory.Token(SyntaxKind.OpenParenToken), line, SyntaxFactory.Token(SyntaxKind.CommaToken), character, SyntaxFactory.Token(SyntaxKind.CloseParenToken)); 6512if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6513if (lineKeyword.Kind() != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 6515if (minusToken.Kind() != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); 6519case SyntaxKind.NumericLiteralToken: 6520case SyntaxKind.None: break; 6523if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6524if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6530=> SyntaxFactory.LineSpanDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), start, SyntaxFactory.Token(SyntaxKind.MinusToken), end, characterOffset, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6534=> SyntaxFactory.LineSpanDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LineKeyword), start, SyntaxFactory.Token(SyntaxKind.MinusToken), end, default, file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6539if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6540if (pragmaKeyword.Kind() != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 6541if (warningKeyword.Kind() != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 6544case SyntaxKind.DisableKeyword: 6545case SyntaxKind.RestoreKeyword: break; 6548if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6554=> SyntaxFactory.PragmaWarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.WarningKeyword), disableOrRestoreKeyword, errorCodes, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6558=> SyntaxFactory.PragmaWarningDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.WarningKeyword), disableOrRestoreKeyword, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6563if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6564if (pragmaKeyword.Kind() != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 6565if (checksumKeyword.Kind() != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); 6566if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6567if (guid.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); 6568if (bytes.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); 6569if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6575=> SyntaxFactory.PragmaChecksumDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.PragmaKeyword), SyntaxFactory.Token(SyntaxKind.ChecksumKeyword), file, guid, bytes, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6580if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6581if (referenceKeyword.Kind() != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); 6582if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6583if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6589=> SyntaxFactory.ReferenceDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ReferenceKeyword), file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6594if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6595if (loadKeyword.Kind() != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); 6596if (file.Kind() != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 6597if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6603=> SyntaxFactory.LoadDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.LoadKeyword), file, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6608if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6609if (exclamationToken.Kind() != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); 6610if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6616=> SyntaxFactory.ShebangDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ExclamationToken), SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6621if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6622if (colonToken.Kind() != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 6625case SyntaxKind.StringLiteralToken: 6626case SyntaxKind.None: break; 6629if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6635=> SyntaxFactory.IgnoredDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ColonToken), content, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6639=> SyntaxFactory.IgnoredDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.ColonToken), default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6644if (hashToken.Kind() != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 6645if (nullableKeyword.Kind() != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); 6648case SyntaxKind.EnableKeyword: 6649case SyntaxKind.DisableKeyword: 6650case SyntaxKind.RestoreKeyword: break; 6655case SyntaxKind.WarningsKeyword: 6656case SyntaxKind.AnnotationsKeyword: 6657case SyntaxKind.None: break; 6660if (endOfDirectiveToken.Kind() != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 6666=> SyntaxFactory.NullableDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.NullableKeyword), settingToken, targetToken, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive); 6670=> SyntaxFactory.NullableDirectiveTrivia(SyntaxFactory.Token(SyntaxKind.HashToken), SyntaxFactory.Token(SyntaxKind.NullableKeyword), settingToken, default, SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken), isActive);
_generated\1\Syntax.xml.Internal.Generated.cs (3178)
17internal NameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22internal NameSyntax(SyntaxKind kind) 31internal SimpleNameSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 36internal SimpleNameSyntax(SyntaxKind kind) 50internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 58internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) 67internal IdentifierNameSyntax(SyntaxKind kind, SyntaxToken identifier) 117internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 129internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right, SyntaxFactoryContext context) 142internal QualifiedNameSyntax(SyntaxKind kind, NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right) 205internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 215internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList, SyntaxFactoryContext context) 226internal GenericNameSyntax(SyntaxKind kind, SyntaxToken identifier, TypeArgumentListSyntax typeArgumentList) 285internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 300internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 316internal TypeArgumentListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? arguments, SyntaxToken greaterThanToken) 383internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 395internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name, SyntaxFactoryContext context) 408internal AliasQualifiedNameSyntax(SyntaxKind kind, IdentifierNameSyntax alias, SyntaxToken colonColonToken, SimpleNameSyntax name) 468internal TypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 473internal TypeSyntax(SyntaxKind kind) 484internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 492internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxFactoryContext context) 501internal PredefinedTypeSyntax(SyntaxKind kind, SyntaxToken keyword) 550internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 563internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers, SyntaxFactoryContext context) 577internal ArrayTypeSyntax(SyntaxKind kind, TypeSyntax elementType, GreenNode? rankSpecifiers) 638internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 653internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 669internal ArrayRankSpecifierSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? sizes, SyntaxToken closeBracketToken) 732internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 742internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken, SyntaxFactoryContext context) 753internal PointerTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken asteriskToken) 812internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 829internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList, SyntaxFactoryContext context) 847internal FunctionPointerTypeSyntax(SyntaxKind kind, SyntaxToken delegateKeyword, SyntaxToken asteriskToken, FunctionPointerCallingConventionSyntax? callingConvention, FunctionPointerParameterListSyntax parameterList) 919internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 934internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 950internal FunctionPointerParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) 1016internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1029internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList, SyntaxFactoryContext context) 1043internal FunctionPointerCallingConventionSyntax(SyntaxKind kind, SyntaxToken managedOrUnmanagedKeyword, FunctionPointerUnmanagedCallingConventionListSyntax? unmanagedCallingConventionList) 1105internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1120internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 1136internal FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? callingConventions, SyntaxToken closeBracketToken) 1201internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1209internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name, SyntaxFactoryContext context) 1218internal FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind kind, SyntaxToken name) 1267internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1277internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken, SyntaxFactoryContext context) 1288internal NullableTypeSyntax(SyntaxKind kind, TypeSyntax elementType, SyntaxToken questionToken) 1347internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1362internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken, SyntaxFactoryContext context) 1378internal TupleTypeSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? elements, SyntaxToken closeParenToken) 1443internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1456internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier, SyntaxFactoryContext context) 1470internal TupleElementSyntax(SyntaxKind kind, TypeSyntax type, SyntaxToken? identifier) 1530internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1538internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken, SyntaxFactoryContext context) 1547internal OmittedTypeArgumentSyntax(SyntaxKind kind, SyntaxToken omittedTypeArgumentToken) 1597internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1612internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) 1628internal RefTypeSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) 1692internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1702internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type, SyntaxFactoryContext context) 1713internal ScopedTypeSyntax(SyntaxKind kind, SyntaxToken scopedKeyword, TypeSyntax type) 1765internal ExpressionOrPatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1770internal ExpressionOrPatternSyntax(SyntaxKind kind) 1779internal ExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1784internal ExpressionSyntax(SyntaxKind kind) 1797internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1809internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 1822internal ParenthesizedExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 1886internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1901internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) 1917internal TupleExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) 1983internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 1993internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand, SyntaxFactoryContext context) 2004internal PrefixUnaryExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) 2062internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2072internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 2083internal AwaitExpressionSyntax(SyntaxKind kind, SyntaxToken awaitKeyword, ExpressionSyntax expression) 2141internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2151internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken, SyntaxFactoryContext context) 2162internal PostfixUnaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) 2221internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2233internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) 2246internal MemberAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) 2310internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2322internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull, SyntaxFactoryContext context) 2335internal ConditionalAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, ExpressionSyntax whenNotNull) 2398internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2408internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name, SyntaxFactoryContext context) 2419internal MemberBindingExpressionSyntax(SyntaxKind kind, SyntaxToken operatorToken, SimpleNameSyntax name) 2476internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2484internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) 2493internal ElementBindingExpressionSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) 2543internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2561internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand, SyntaxFactoryContext context) 2580internal RangeExpressionSyntax(SyntaxKind kind, ExpressionSyntax? leftOperand, SyntaxToken operatorToken, ExpressionSyntax? rightOperand) 2648internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2656internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) 2665internal ImplicitElementAccessSyntax(SyntaxKind kind, BracketedArgumentListSyntax argumentList) 2715internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2727internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) 2740internal BinaryExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 2804internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2816internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right, SyntaxFactoryContext context) 2829internal AssignmentExpressionSyntax(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 2895internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 2911internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse, SyntaxFactoryContext context) 2928internal ConditionalExpressionSyntax(SyntaxKind kind, ExpressionSyntax condition, SyntaxToken questionToken, ExpressionSyntax whenTrue, SyntaxToken colonToken, ExpressionSyntax whenFalse) 2998internal InstanceExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3003internal InstanceExpressionSyntax(SyntaxKind kind) 3014internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3022internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) 3031internal ThisExpressionSyntax(SyntaxKind kind, SyntaxToken token) 3079internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3087internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) 3096internal BaseExpressionSyntax(SyntaxKind kind, SyntaxToken token) 3144internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3152internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) 3161internal LiteralExpressionSyntax(SyntaxKind kind, SyntaxToken token) 3209internal FieldExpressionSyntax(SyntaxKind kind, SyntaxToken token, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3217internal FieldExpressionSyntax(SyntaxKind kind, SyntaxToken token, SyntaxFactoryContext context) 3226internal FieldExpressionSyntax(SyntaxKind kind, SyntaxToken token) 3277internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3291internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3306internal MakeRefExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 3376internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3390internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3405internal RefTypeExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 3477internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3495internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3514internal RefValueExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken comma, TypeSyntax type, SyntaxToken closeParenToken) 3594internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3608internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3623internal CheckedExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 3693internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3707internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3722internal DefaultExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 3792internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3806internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3821internal TypeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 3891internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3905internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, SyntaxFactoryContext context) 3920internal SizeOfExpressionSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken) 3988internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 3998internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 4009internal InvocationExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, ArgumentListSyntax argumentList) 4067internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4077internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList, SyntaxFactoryContext context) 4088internal ElementAccessExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, BracketedArgumentListSyntax argumentList) 4143internal BaseArgumentListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4148internal BaseArgumentListSyntax(SyntaxKind kind) 4164internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4179internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) 4195internal ArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) 4262internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4277internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 4293internal BracketedArgumentListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? arguments, SyntaxToken closeBracketToken) 4360internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4378internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 4397internal ArgumentSyntax(SyntaxKind kind, NameColonSyntax? nameColon, SyntaxToken? refKindKeyword, ExpressionSyntax expression) 4462internal BaseExpressionColonSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4467internal BaseExpressionColonSyntax(SyntaxKind kind) 4482internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4492internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken, SyntaxFactoryContext context) 4503internal ExpressionColonSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken colonToken) 4559internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4569internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken, SyntaxFactoryContext context) 4580internal NameColonSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken colonToken) 4638internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4648internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) 4659internal DeclarationExpressionSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) 4718internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4732internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression, SyntaxFactoryContext context) 4747internal CastExpressionSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken, ExpressionSyntax expression) 4812internal AnonymousFunctionExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4817internal AnonymousFunctionExpressionSyntax(SyntaxKind kind) 4846internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4871internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) 4897internal AnonymousMethodExpressionSyntax(SyntaxKind kind, GreenNode? modifiers, SyntaxToken delegateKeyword, ParameterListSyntax? parameterList, BlockSyntax block, ExpressionSyntax? expressionBody) 4981internal LambdaExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 4986internal LambdaExpressionSyntax(SyntaxKind kind) 5007internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5037internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) 5068internal SimpleLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, ParameterSyntax parameter, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) 5161internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5171internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 5182internal RefExpressionSyntax(SyntaxKind kind, SyntaxToken refKeyword, ExpressionSyntax expression) 5243internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5278internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody, SyntaxFactoryContext context) 5314internal ParenthesizedLambdaExpressionSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? returnType, ParameterListSyntax parameterList, SyntaxToken arrowToken, BlockSyntax? block, ExpressionSyntax? expressionBody) 5416internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5431internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 5447internal InitializerExpressionSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? expressions, SyntaxToken closeBraceToken) 5509internal BaseObjectCreationExpressionSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5514internal BaseObjectCreationExpressionSyntax(SyntaxKind kind) 5536internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5551internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 5567internal ImplicitObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArgumentListSyntax argumentList, InitializerExpressionSyntax? initializer) 5635internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5655internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 5676internal ObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, TypeSyntax type, ArgumentListSyntax? argumentList, InitializerExpressionSyntax? initializer) 5750internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5762internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) 5775internal WithExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken withKeyword, InitializerExpressionSyntax initializer) 5835internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5848internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression, SyntaxFactoryContext context) 5862internal AnonymousObjectMemberDeclaratorSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, ExpressionSyntax expression) 5925internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 5942internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 5960internal AnonymousObjectCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBraceToken, GreenNode? initializers, SyntaxToken closeBraceToken) 6032internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6047internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 6063internal ArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, ArrayTypeSyntax type, InitializerExpressionSyntax? initializer) 6132internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6151internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) 6171internal ImplicitArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openBracketToken, GreenNode? commas, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) 6248internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6263internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer, SyntaxFactoryContext context) 6279internal StackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, TypeSyntax type, InitializerExpressionSyntax? initializer) 6347internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6361internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer, SyntaxFactoryContext context) 6376internal ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind kind, SyntaxToken stackAllocKeyword, SyntaxToken openBracketToken, SyntaxToken closeBracketToken, InitializerExpressionSyntax initializer) 6444internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6459internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 6475internal CollectionExpressionSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? elements, SyntaxToken closeBracketToken) 6535internal CollectionElementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6540internal CollectionElementSyntax(SyntaxKind kind) 6550internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6558internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) 6567internal ExpressionElementSyntax(SyntaxKind kind, ExpressionSyntax expression) 6614internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6624internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) 6635internal SpreadElementSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) 6690internal WithElementSyntax(SyntaxKind kind, SyntaxToken withKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6700internal WithElementSyntax(SyntaxKind kind, SyntaxToken withKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 6711internal WithElementSyntax(SyntaxKind kind, SyntaxToken withKeyword, ArgumentListSyntax argumentList) 6763internal QueryClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6768internal QueryClauseSyntax(SyntaxKind kind) 6776internal SelectOrGroupClauseSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6781internal SelectOrGroupClauseSyntax(SyntaxKind kind) 6792internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6802internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body, SyntaxFactoryContext context) 6813internal QueryExpressionSyntax(SyntaxKind kind, FromClauseSyntax fromClause, QueryBodySyntax body) 6869internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6887internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation, SyntaxFactoryContext context) 6906internal QueryBodySyntax(SyntaxKind kind, GreenNode? clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation) 6974internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 6993internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 7013internal FromClauseSyntax(SyntaxKind kind, SyntaxToken fromKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression) 7086internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7100internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression, SyntaxFactoryContext context) 7115internal LetClauseSyntax(SyntaxKind kind, SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression) 7187internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7219internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into, SyntaxFactoryContext context) 7252internal JoinClauseSyntax(SyntaxKind kind, SyntaxToken joinKeyword, TypeSyntax? type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax inExpression, SyntaxToken onKeyword, ExpressionSyntax leftExpression, SyntaxToken equalsKeyword, ExpressionSyntax rightExpression, JoinIntoClauseSyntax? into) 7346internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7356internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, SyntaxFactoryContext context) 7367internal JoinIntoClauseSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier) 7423internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7433internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) 7444internal WhereClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, ExpressionSyntax condition) 7499internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7512internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings, SyntaxFactoryContext context) 7526internal OrderByClauseSyntax(SyntaxKind kind, SyntaxToken orderByKeyword, GreenNode? orderings) 7584internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7597internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword, SyntaxFactoryContext context) 7611internal OrderingSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) 7669internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7679internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 7690internal SelectClauseSyntax(SyntaxKind kind, SyntaxToken selectKeyword, ExpressionSyntax expression) 7747internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7761internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression, SyntaxFactoryContext context) 7776internal GroupClauseSyntax(SyntaxKind kind, SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression) 7840internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7852internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body, SyntaxFactoryContext context) 7865internal QueryContinuationSyntax(SyntaxKind kind, SyntaxToken intoKeyword, SyntaxToken identifier, QueryBodySyntax body) 7925internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 7933internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken, SyntaxFactoryContext context) 7942internal OmittedArraySizeExpressionSyntax(SyntaxKind kind, SyntaxToken omittedArraySizeExpressionToken) 7991internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8006internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken, SyntaxFactoryContext context) 8022internal InterpolatedStringExpressionSyntax(SyntaxKind kind, SyntaxToken stringStartToken, GreenNode? contents, SyntaxToken stringEndToken) 8089internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8101internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern, SyntaxFactoryContext context) 8114internal IsPatternExpressionSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken isKeyword, PatternSyntax pattern) 8175internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8185internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression, SyntaxFactoryContext context) 8196internal ThrowExpressionSyntax(SyntaxKind kind, SyntaxToken throwKeyword, ExpressionSyntax expression) 8251internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8261internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition, SyntaxFactoryContext context) 8272internal WhenClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, ExpressionSyntax condition) 8324internal PatternSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8329internal PatternSyntax(SyntaxKind kind) 8339internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8347internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) 8356internal DiscardPatternSyntax(SyntaxKind kind, SyntaxToken underscoreToken) 8403internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8413internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation, SyntaxFactoryContext context) 8424internal DeclarationPatternSyntax(SyntaxKind kind, TypeSyntax type, VariableDesignationSyntax designation) 8479internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8489internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation, SyntaxFactoryContext context) 8500internal VarPatternSyntax(SyntaxKind kind, SyntaxToken varKeyword, VariableDesignationSyntax designation) 8557internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8583internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation, SyntaxFactoryContext context) 8610internal RecursivePatternSyntax(SyntaxKind kind, TypeSyntax? type, PositionalPatternClauseSyntax? positionalPatternClause, PropertyPatternClauseSyntax? propertyPatternClause, VariableDesignationSyntax? designation) 8686internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8701internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken, SyntaxFactoryContext context) 8717internal PositionalPatternClauseSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? subpatterns, SyntaxToken closeParenToken) 8780internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8795internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 8811internal PropertyPatternClauseSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? subpatterns, SyntaxToken closeBraceToken) 8873internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8886internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern, SyntaxFactoryContext context) 8900internal SubpatternSyntax(SyntaxKind kind, BaseExpressionColonSyntax? expressionColon, PatternSyntax pattern) 8957internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 8965internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression, SyntaxFactoryContext context) 8974internal ConstantPatternSyntax(SyntaxKind kind, ExpressionSyntax expression) 9023internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9035internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken, SyntaxFactoryContext context) 9048internal ParenthesizedPatternSyntax(SyntaxKind kind, SyntaxToken openParenToken, PatternSyntax pattern, SyntaxToken closeParenToken) 9107internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9117internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression, SyntaxFactoryContext context) 9128internal RelationalPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax expression) 9183internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9191internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 9200internal TypePatternSyntax(SyntaxKind kind, TypeSyntax type) 9249internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9261internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right, SyntaxFactoryContext context) 9274internal BinaryPatternSyntax(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 9333internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9343internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern, SyntaxFactoryContext context) 9354internal UnaryPatternSyntax(SyntaxKind kind, SyntaxToken operatorToken, PatternSyntax pattern) 9411internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9431internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation, SyntaxFactoryContext context) 9452internal ListPatternSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? patterns, SyntaxToken closeBracketToken, VariableDesignationSyntax? designation) 9521internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9534internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern, SyntaxFactoryContext context) 9548internal SlicePatternSyntax(SyntaxKind kind, SyntaxToken dotDotToken, PatternSyntax? pattern) 9603internal InterpolatedStringContentSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9608internal InterpolatedStringContentSyntax(SyntaxKind kind) 9618internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9626internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken, SyntaxFactoryContext context) 9635internal InterpolatedStringTextSyntax(SyntaxKind kind, SyntaxToken textToken) 9686internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9708internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 9731internal InterpolationSyntax(SyntaxKind kind, SyntaxToken openBraceToken, ExpressionSyntax expression, InterpolationAlignmentClauseSyntax? alignmentClause, InterpolationFormatClauseSyntax? formatClause, SyntaxToken closeBraceToken) 9808internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9818internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value, SyntaxFactoryContext context) 9829internal InterpolationAlignmentClauseSyntax(SyntaxKind kind, SyntaxToken commaToken, ExpressionSyntax value) 9884internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9894internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken, SyntaxFactoryContext context) 9905internal InterpolationFormatClauseSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken formatStringToken) 9963internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 9981internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement, SyntaxFactoryContext context) 10000internal GlobalStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, StatementSyntax statement) 10063internal StatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10068internal StatementSyntax(SyntaxKind kind) 10083internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10103internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 10124internal BlockSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken openBraceToken, GreenNode? statements, SyntaxToken closeBraceToken) 10201internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10248internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 10296internal LocalFunctionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 10410internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10440internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) 10471internal LocalDeclarationStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken? usingKeyword, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 10555internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10568internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables, SyntaxFactoryContext context) 10582internal VariableDeclarationSyntax(SyntaxKind kind, TypeSyntax type, GreenNode? variables) 10641internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10659internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer, SyntaxFactoryContext context) 10678internal VariableDeclaratorSyntax(SyntaxKind kind, SyntaxToken identifier, BracketedArgumentListSyntax? argumentList, EqualsValueClauseSyntax? initializer) 10744internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10754internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value, SyntaxFactoryContext context) 10765internal EqualsValueClauseSyntax(SyntaxKind kind, SyntaxToken equalsToken, ExpressionSyntax value) 10817internal VariableDesignationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10822internal VariableDesignationSyntax(SyntaxKind kind) 10832internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10840internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxFactoryContext context) 10849internal SingleVariableDesignationSyntax(SyntaxKind kind, SyntaxToken identifier) 10895internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10903internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken, SyntaxFactoryContext context) 10912internal DiscardDesignationSyntax(SyntaxKind kind, SyntaxToken underscoreToken) 10960internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 10975internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken, SyntaxFactoryContext context) 10991internal ParenthesizedVariableDesignationSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? variables, SyntaxToken closeParenToken) 11054internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11069internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11085internal ExpressionStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, ExpressionSyntax expression, SyntaxToken semicolonToken) 11147internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11160internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11174internal EmptyStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken semicolonToken) 11235internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11252internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement, SyntaxFactoryContext context) 11270internal LabeledStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken identifier, SyntaxToken colonToken, StatementSyntax statement) 11344internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11369internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11395internal GotoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 11484internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11499internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11515internal BreakStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken breakKeyword, SyntaxToken semicolonToken) 11578internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11593internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11609internal ContinueStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken continueKeyword, SyntaxToken semicolonToken) 11673internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11693internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11714internal ReturnStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken returnKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 11785internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11805internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11826internal ThrowStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken throwKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 11898internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 11920internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken, SyntaxFactoryContext context) 11943internal YieldStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 12020internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12041internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12063internal WhileStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement) 12143internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12168internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken, SyntaxFactoryContext context) 12194internal DoStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken doKeyword, StatementSyntax statement, SyntaxToken whileKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, SyntaxToken semicolonToken) 12285internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12328internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12372internal ForStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken forKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, GreenNode? initializers, SyntaxToken firstSemicolonToken, ExpressionSyntax? condition, SyntaxToken secondSemicolonToken, GreenNode? incrementors, SyntaxToken closeParenToken, StatementSyntax statement) 12475internal CommonForEachStatementSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12480internal CommonForEachStatementSyntax(SyntaxKind kind) 12513internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12545internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12578internal ForEachStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken identifier, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 12679internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12709internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12740internal ForEachVariableStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken forEachKeyword, SyntaxToken openParenToken, ExpressionSyntax variable, SyntaxToken inKeyword, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 12841internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 12875internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 12910internal UsingStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? awaitKeyword, SyntaxToken usingKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax? declaration, ExpressionSyntax? expression, SyntaxToken closeParenToken, StatementSyntax statement) 13005internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13026internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 13048internal FixedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken fixedKeyword, SyntaxToken openParenToken, VariableDeclarationSyntax declaration, SyntaxToken closeParenToken, StatementSyntax statement) 13123internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13138internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block, SyntaxFactoryContext context) 13154internal CheckedStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken keyword, BlockSyntax block) 13217internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13232internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block, SyntaxFactoryContext context) 13248internal UnsafeStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block) 13314internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13335internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement, SyntaxFactoryContext context) 13357internal LockStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken lockKeyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken, StatementSyntax statement) 13439internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13465internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else, SyntaxFactoryContext context) 13492internal IfStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken ifKeyword, SyntaxToken openParenToken, ExpressionSyntax condition, SyntaxToken closeParenToken, StatementSyntax statement, ElseClauseSyntax? @else) 13592internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13602internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement, SyntaxFactoryContext context) 13613internal ElseClauseSyntax(SyntaxKind kind, SyntaxToken elseKeyword, StatementSyntax statement) 13678internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13712internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 13747internal SwitchStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken switchKeyword, SyntaxToken? openParenToken, ExpressionSyntax expression, SyntaxToken? closeParenToken, SyntaxToken openBraceToken, GreenNode? sections, SyntaxToken closeBraceToken) 13860internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13876internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements, SyntaxFactoryContext context) 13893internal SwitchSectionSyntax(SyntaxKind kind, GreenNode? labels, GreenNode? statements) 13958internal SwitchLabelSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 13963internal SwitchLabelSyntax(SyntaxKind kind) 13987internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14004internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken, SyntaxFactoryContext context) 14022internal CasePatternSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken colonToken) 14094internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14106internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken, SyntaxFactoryContext context) 14119internal CaseSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken) 14183internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14193internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken, SyntaxFactoryContext context) 14204internal DefaultSwitchLabelSyntax(SyntaxKind kind, SyntaxToken keyword, SyntaxToken colonToken) 14263internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14282internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 14302internal SwitchExpressionSyntax(SyntaxKind kind, ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, GreenNode? arms, SyntaxToken closeBraceToken) 14374internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14391internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression, SyntaxFactoryContext context) 14409internal SwitchExpressionArmSyntax(SyntaxKind kind, PatternSyntax pattern, WhenClauseSyntax? whenClause, SyntaxToken equalsGreaterThanToken, ExpressionSyntax expression) 14478internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14503internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally, SyntaxFactoryContext context) 14529internal TryStatementSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken tryKeyword, BlockSyntax block, GreenNode? catches, FinallyClauseSyntax? @finally) 14607internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14627internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block, SyntaxFactoryContext context) 14648internal CatchClauseSyntax(SyntaxKind kind, SyntaxToken catchKeyword, CatchDeclarationSyntax? declaration, CatchFilterClauseSyntax? filter, BlockSyntax block) 14719internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14736internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken, SyntaxFactoryContext context) 14754internal CatchDeclarationSyntax(SyntaxKind kind, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken? identifier, SyntaxToken closeParenToken) 14822internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14836internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken, SyntaxFactoryContext context) 14851internal CatchFilterClauseSyntax(SyntaxKind kind, SyntaxToken whenKeyword, SyntaxToken openParenToken, ExpressionSyntax filterExpression, SyntaxToken closeParenToken) 14914internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 14924internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block, SyntaxFactoryContext context) 14935internal FinallyClauseSyntax(SyntaxKind kind, SyntaxToken finallyKeyword, BlockSyntax block) 14993internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15021internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken, SyntaxFactoryContext context) 15050internal CompilationUnitSyntax(SyntaxKind kind, GreenNode? externs, GreenNode? usings, GreenNode? attributeLists, GreenNode? members, SyntaxToken endOfFileToken) 15135internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15149internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken, SyntaxFactoryContext context) 15164internal ExternAliasDirectiveSyntax(SyntaxKind kind, SyntaxToken externKeyword, SyntaxToken aliasKeyword, SyntaxToken identifier, SyntaxToken semicolonToken) 15236internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15268internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken, SyntaxFactoryContext context) 15301internal UsingDirectiveSyntax(SyntaxKind kind, SyntaxToken? globalKeyword, SyntaxToken usingKeyword, SyntaxToken? staticKeyword, SyntaxToken? unsafeKeyword, NameEqualsSyntax? alias, TypeSyntax namespaceOrType, SyntaxToken semicolonToken) 15386internal MemberDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15391internal MemberDeclarationSyntax(SyntaxKind kind) 15405internal BaseNamespaceDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15410internal BaseNamespaceDeclarationSyntax(SyntaxKind kind) 15439internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15483internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 15528internal NamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken openBraceToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxToken closeBraceToken, SyntaxToken? semicolonToken) 15640internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15677internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members, SyntaxFactoryContext context) 15715internal FileScopedNamespaceDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken namespaceKeyword, NameSyntax name, SyntaxToken semicolonToken, GreenNode? externs, GreenNode? usings, GreenNode? members) 15812internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15832internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 15853internal AttributeListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, GreenNode? attributes, SyntaxToken closeBracketToken) 15927internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 15937internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken, SyntaxFactoryContext context) 15948internal AttributeTargetSpecifierSyntax(SyntaxKind kind, SyntaxToken identifier, SyntaxToken colonToken) 16006internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16020internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList, SyntaxFactoryContext context) 16035internal AttributeSyntax(SyntaxKind kind, NameSyntax name, AttributeArgumentListSyntax? argumentList) 16097internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16112internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken, SyntaxFactoryContext context) 16128internal AttributeArgumentListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? arguments, SyntaxToken closeParenToken) 16195internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16213internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression, SyntaxFactoryContext context) 16232internal AttributeArgumentSyntax(SyntaxKind kind, NameEqualsSyntax? nameEquals, NameColonSyntax? nameColon, ExpressionSyntax expression) 16299internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16309internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken, SyntaxFactoryContext context) 16320internal NameEqualsSyntax(SyntaxKind kind, IdentifierNameSyntax name, SyntaxToken equalsToken) 16378internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16393internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 16409internal TypeParameterListSyntax(SyntaxKind kind, SyntaxToken lessThanToken, GreenNode? parameters, SyntaxToken greaterThanToken) 16476internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16494internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier, SyntaxFactoryContext context) 16513internal TypeParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, SyntaxToken? varianceKeyword, SyntaxToken identifier) 16578internal BaseTypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16583internal BaseTypeDeclarationSyntax(SyntaxKind kind) 16607internal TypeDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16612internal TypeDeclarationSyntax(SyntaxKind kind) 16647internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16707internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 16768internal ClassDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 16905internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 16965internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 17026internal StructDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 17163internal 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) 17223internal 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) 17284internal 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) 17421internal 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) 17486internal 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) 17552internal 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) 17692internal 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) 17737internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 17783internal EnumDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken enumKeyword, SyntaxToken identifier, BaseListSyntax? baseList, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 17898internal 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) 17934internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken, SyntaxFactoryContext context) 17971internal DelegateDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken delegateKeyword, TypeSyntax returnType, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, GreenNode? constraintClauses, SyntaxToken semicolonToken) 18074internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18097internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue, SyntaxFactoryContext context) 18121internal EnumMemberDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, EqualsValueClauseSyntax? equalsValue) 18203internal 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) 18256internal 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) 18310internal ExtensionBlockDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, GreenNode? constraintClauses, SyntaxToken? openBraceToken, GreenNode? members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 18425internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18438internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types, SyntaxFactoryContext context) 18452internal BaseListSyntax(SyntaxKind kind, SyntaxToken colonToken, GreenNode? types) 18510internal BaseTypeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18515internal BaseTypeSyntax(SyntaxKind kind) 18527internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18535internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 18544internal SimpleBaseTypeSyntax(SyntaxKind kind, TypeSyntax type) 18591internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18601internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 18612internal PrimaryConstructorBaseTypeSyntax(SyntaxKind kind, TypeSyntax type, ArgumentListSyntax argumentList) 18670internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18687internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints, SyntaxFactoryContext context) 18705internal TypeParameterConstraintClauseSyntax(SyntaxKind kind, SyntaxToken whereKeyword, IdentifierNameSyntax name, SyntaxToken colonToken, GreenNode? constraints) 18772internal TypeParameterConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18777internal TypeParameterConstraintSyntax(SyntaxKind kind) 18790internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18802internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken, SyntaxFactoryContext context) 18815internal ConstructorConstraintSyntax(SyntaxKind kind, SyntaxToken newKeyword, SyntaxToken openParenToken, SyntaxToken closeParenToken) 18878internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18891internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken, SyntaxFactoryContext context) 18905internal ClassOrStructConstraintSyntax(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) 18965internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 18973internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 18982internal TypeConstraintSyntax(SyntaxKind kind, TypeSyntax type) 19030internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19038internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword, SyntaxFactoryContext context) 19047internal DefaultConstraintSyntax(SyntaxKind kind, SyntaxToken defaultKeyword) 19096internal AllowsConstraintClauseSyntax(SyntaxKind kind, SyntaxToken allowsKeyword, GreenNode? constraints, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19109internal AllowsConstraintClauseSyntax(SyntaxKind kind, SyntaxToken allowsKeyword, GreenNode? constraints, SyntaxFactoryContext context) 19123internal AllowsConstraintClauseSyntax(SyntaxKind kind, SyntaxToken allowsKeyword, GreenNode? constraints) 19180internal AllowsConstraintSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19185internal AllowsConstraintSyntax(SyntaxKind kind) 19197internal RefStructConstraintSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken structKeyword, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19207internal RefStructConstraintSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken structKeyword, SyntaxFactoryContext context) 19218internal RefStructConstraintSyntax(SyntaxKind kind, SyntaxToken refKeyword, SyntaxToken structKeyword) 19272internal BaseFieldDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19277internal BaseFieldDeclarationSyntax(SyntaxKind kind) 19294internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19314internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) 19335internal FieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 19407internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19429internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken, SyntaxFactoryContext context) 19452internal EventFieldDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, VariableDeclarationSyntax declaration, SyntaxToken semicolonToken) 19525internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19535internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken, SyntaxFactoryContext context) 19546internal ExplicitInterfaceSpecifierSyntax(SyntaxKind kind, NameSyntax name, SyntaxToken dotToken) 19599internal BaseMethodDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 19604internal BaseMethodDeclarationSyntax(SyntaxKind kind) 19635internal 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) 19687internal 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) 19740internal 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) 19869internal 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) 19918internal 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) 19968internal 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) 20095internal 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) 20144internal 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) 20194internal 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) 20318internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 20358internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 20399internal ConstructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken identifier, ParameterListSyntax parameterList, ConstructorInitializerSyntax? initializer, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 20500internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 20512internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList, SyntaxFactoryContext context) 20525internal ConstructorInitializerSyntax(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 20593internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 20630internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 20668internal DestructorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken tildeToken, SyntaxToken identifier, ParameterListSyntax parameterList, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 20763internal BasePropertyDeclarationSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 20768internal BasePropertyDeclarationSyntax(SyntaxKind kind) 20794internal 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) 20839internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 20885internal PropertyDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, EqualsValueClauseSyntax? initializer, SyntaxToken? semicolonToken) 20991internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21001internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression, SyntaxFactoryContext context) 21012internal ArrowExpressionClauseSyntax(SyntaxKind kind, SyntaxToken arrowToken, ExpressionSyntax expression) 21073internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21110internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21148internal EventDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken eventKeyword, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, AccessorListSyntax? accessorList, SyntaxToken? semicolonToken) 21250internal 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) 21292internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21335internal IndexerDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken thisKeyword, BracketedParameterListSyntax parameterList, AccessorListSyntax? accessorList, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 21438internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21453internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken, SyntaxFactoryContext context) 21469internal AccessorListSyntax(SyntaxKind kind, SyntaxToken openBraceToken, GreenNode? accessors, SyntaxToken closeBraceToken) 21535internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21568internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken, SyntaxFactoryContext context) 21602internal AccessorDeclarationSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 21692internal BaseParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21697internal BaseParameterListSyntax(SyntaxKind kind) 21713internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21728internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) 21744internal ParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) 21810internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21825internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 21841internal BracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) 21903internal BaseParameterSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21908internal BaseParameterSyntax(SyntaxKind kind) 21931internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken? identifier, EqualsValueClauseSyntax? @default, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 21962internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken? identifier, EqualsValueClauseSyntax? @default, SyntaxFactoryContext context) 21994internal ParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxToken? identifier, EqualsValueClauseSyntax? @default) 22081internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22099internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type, SyntaxFactoryContext context) 22118internal FunctionPointerParameterSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax type) 22186internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22207internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type, SyntaxFactoryContext context) 22229internal IncompleteMemberSyntax(SyntaxKind kind, GreenNode? attributeLists, GreenNode? modifiers, TypeSyntax? type) 22296internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22307internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens, SyntaxFactoryContext context) 22319internal SkippedTokensTriviaSyntax(SyntaxKind kind, GreenNode? tokens) 22369internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22382internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment, SyntaxFactoryContext context) 22396internal DocumentationCommentTriviaSyntax(SyntaxKind kind, GreenNode? content, SyntaxToken endOfComment) 22455internal CrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22460internal CrefSyntax(SyntaxKind kind) 22477internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22485internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type, SyntaxFactoryContext context) 22494internal TypeCrefSyntax(SyntaxKind kind, TypeSyntax type) 22549internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22561internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context) 22574internal QualifiedCrefSyntax(SyntaxKind kind, TypeSyntax container, SyntaxToken dotToken, MemberCrefSyntax member) 22637internal MemberCrefSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22642internal MemberCrefSyntax(SyntaxKind kind) 22659internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22672internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) 22686internal NameMemberCrefSyntax(SyntaxKind kind, TypeSyntax name, CrefParameterListSyntax? parameters) 22747internal ExtensionMemberCrefSyntax(SyntaxKind kind, SyntaxToken extensionKeyword, TypeArgumentListSyntax? typeArgumentList, CrefParameterListSyntax parameters, SyntaxToken dotToken, MemberCrefSyntax member, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22766internal ExtensionMemberCrefSyntax(SyntaxKind kind, SyntaxToken extensionKeyword, TypeArgumentListSyntax? typeArgumentList, CrefParameterListSyntax parameters, SyntaxToken dotToken, MemberCrefSyntax member, SyntaxFactoryContext context) 22786internal ExtensionMemberCrefSyntax(SyntaxKind kind, SyntaxToken extensionKeyword, TypeArgumentListSyntax? typeArgumentList, CrefParameterListSyntax parameters, SyntaxToken dotToken, MemberCrefSyntax member) 22860internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22873internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters, SyntaxFactoryContext context) 22887internal IndexerMemberCrefSyntax(SyntaxKind kind, SyntaxToken thisKeyword, CrefBracketedParameterListSyntax? parameters) 22952internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 22972internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) 22993internal OperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, SyntaxToken operatorToken, CrefParameterListSyntax? parameters) 23070internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23092internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters, SyntaxFactoryContext context) 23115internal ConversionOperatorMemberCrefSyntax(SyntaxKind kind, SyntaxToken implicitOrExplicitKeyword, SyntaxToken operatorKeyword, SyntaxToken? checkedKeyword, TypeSyntax type, CrefParameterListSyntax? parameters) 23189internal BaseCrefParameterListSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23194internal BaseCrefParameterListSyntax(SyntaxKind kind) 23212internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23227internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken, SyntaxFactoryContext context) 23243internal CrefParameterListSyntax(SyntaxKind kind, SyntaxToken openParenToken, GreenNode? parameters, SyntaxToken closeParenToken) 23311internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23326internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken, SyntaxFactoryContext context) 23342internal CrefBracketedParameterListSyntax(SyntaxKind kind, SyntaxToken openBracketToken, GreenNode? parameters, SyntaxToken closeBracketToken) 23413internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23431internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type, SyntaxFactoryContext context) 23450internal CrefParameterSyntax(SyntaxKind kind, SyntaxToken? refKindKeyword, SyntaxToken? readOnlyKeyword, TypeSyntax type) 23512internal XmlNodeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23517internal XmlNodeSyntax(SyntaxKind kind) 23529internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23544internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag, SyntaxFactoryContext context) 23560internal XmlElementSyntax(SyntaxKind kind, XmlElementStartTagSyntax startTag, GreenNode? content, XmlElementEndTagSyntax endTag) 23624internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23641internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 23659internal XmlElementStartTagSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken greaterThanToken) 23726internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23738internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken, SyntaxFactoryContext context) 23751internal XmlElementEndTagSyntax(SyntaxKind kind, SyntaxToken lessThanSlashToken, XmlNameSyntax name, SyntaxToken greaterThanToken) 23812internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23829internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken, SyntaxFactoryContext context) 23847internal XmlEmptyElementSyntax(SyntaxKind kind, SyntaxToken lessThanToken, XmlNameSyntax name, GreenNode? attributes, SyntaxToken slashGreaterThanToken) 23913internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 23926internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName, SyntaxFactoryContext context) 23940internal XmlNameSyntax(SyntaxKind kind, XmlPrefixSyntax? prefix, SyntaxToken localName) 23998internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24008internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken, SyntaxFactoryContext context) 24019internal XmlPrefixSyntax(SyntaxKind kind, SyntaxToken prefix, SyntaxToken colonToken) 24071internal XmlAttributeSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24076internal XmlAttributeSyntax(SyntaxKind kind) 24098internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24117internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken, SyntaxFactoryContext context) 24137internal XmlTextAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, GreenNode? textTokens, SyntaxToken endQuoteToken) 24210internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24226internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken, SyntaxFactoryContext context) 24243internal XmlCrefAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, CrefSyntax cref, SyntaxToken endQuoteToken) 24313internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24329internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken, SyntaxFactoryContext context) 24346internal XmlNameAttributeSyntax(SyntaxKind kind, XmlNameSyntax name, SyntaxToken equalsToken, SyntaxToken startQuoteToken, IdentifierNameSyntax identifier, SyntaxToken endQuoteToken) 24412internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24423internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens, SyntaxFactoryContext context) 24435internal XmlTextSyntax(SyntaxKind kind, GreenNode? textTokens) 24486internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24501internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken, SyntaxFactoryContext context) 24517internal XmlCDataSectionSyntax(SyntaxKind kind, SyntaxToken startCDataToken, GreenNode? textTokens, SyntaxToken endCDataToken) 24581internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24598internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken, SyntaxFactoryContext context) 24616internal XmlProcessingInstructionSyntax(SyntaxKind kind, SyntaxToken startProcessingInstructionToken, XmlNameSyntax name, GreenNode? textTokens, SyntaxToken endProcessingInstructionToken) 24683internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24698internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken, SyntaxFactoryContext context) 24714internal XmlCommentSyntax(SyntaxKind kind, SyntaxToken lessThanExclamationMinusMinusToken, GreenNode? textTokens, SyntaxToken minusMinusGreaterThanToken) 24773internal DirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24779internal DirectiveTriviaSyntax(SyntaxKind kind) 24794internal BranchingDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24799internal BranchingDirectiveTriviaSyntax(SyntaxKind kind) 24809internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24814internal ConditionalDirectiveTriviaSyntax(SyntaxKind kind) 24834internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24851internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) 24869internal IfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken ifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) 24943internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 24960internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue, SyntaxFactoryContext context) 24978internal ElifDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elifKeyword, ExpressionSyntax condition, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, bool conditionValue) 25050internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25064internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken, SyntaxFactoryContext context) 25079internal ElseDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken elseKeyword, SyntaxToken endOfDirectiveToken, bool isActive, bool branchTaken) 25144internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25157internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25171internal EndIfDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endIfKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25234internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25247internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25261internal RegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken regionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25324internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25337internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25351internal EndRegionDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken endRegionKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25414internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25427internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25441internal ErrorDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken errorKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25504internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25517internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25531internal WarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken warningKeyword, SyntaxToken endOfDirectiveToken, bool isActive) 25594internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25607internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25621internal BadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken identifier, SyntaxToken endOfDirectiveToken, bool isActive) 25685internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25700internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25716internal DefineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken defineKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) 25784internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25799internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25815internal UndefDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken undefKeyword, SyntaxToken name, SyntaxToken endOfDirectiveToken, bool isActive) 25877internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25882internal LineOrSpanDirectiveTriviaSyntax(SyntaxKind kind) 25901internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 25921internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 25942internal LineDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, SyntaxToken line, SyntaxToken? file, SyntaxToken endOfDirectiveToken, bool isActive) 26017internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26033internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken, SyntaxFactoryContext context) 26050internal LineDirectivePositionSyntax(SyntaxKind kind, SyntaxToken openParenToken, SyntaxToken line, SyntaxToken commaToken, SyntaxToken character, SyntaxToken closeParenToken) 26124internal 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) 26150internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26177internal LineSpanDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken lineKeyword, LineDirectivePositionSyntax start, SyntaxToken minusToken, LineDirectivePositionSyntax end, SyntaxToken? characterOffset, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) 26266internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26288internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26311internal PragmaWarningDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken warningKeyword, SyntaxToken disableOrRestoreKeyword, GreenNode? errorCodes, SyntaxToken endOfDirectiveToken, bool isActive) 26393internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26414internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26436internal PragmaChecksumDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken pragmaKeyword, SyntaxToken checksumKeyword, SyntaxToken file, SyntaxToken guid, SyntaxToken bytes, SyntaxToken endOfDirectiveToken, bool isActive) 26516internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26531internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26547internal ReferenceDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken referenceKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) 26615internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26630internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26646internal LoadDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken loadKeyword, SyntaxToken file, SyntaxToken endOfDirectiveToken, bool isActive) 26713internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26726internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26740internal ShebangDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken exclamationToken, SyntaxToken endOfDirectiveToken, bool isActive) 26804internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26822internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26841internal IgnoredDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken colonToken, SyntaxToken? content, SyntaxToken endOfDirectiveToken, bool isActive) 26913internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, DiagnosticInfo[]? diagnostics, SyntaxAnnotation[]? annotations) 26933internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive, SyntaxFactoryContext context) 26954internal NullableDirectiveTriviaSyntax(SyntaxKind kind, SyntaxToken hashToken, SyntaxToken nullableKeyword, SyntaxToken settingToken, SyntaxToken? targetToken, SyntaxToken endOfDirectiveToken, bool isActive) 28286case SyntaxKind.IdentifierToken: 28287case SyntaxKind.GlobalKeyword: break; 28293var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, this.context, out hash); 28296var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier, this.context); 28310if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 28315var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, this.context, out hash); 28318var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right, this.context); 28331if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 28336var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, this.context, out hash); 28339var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList, this.context); 28352if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 28354if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 28358var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context, out hash); 28361var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, this.context); 28375if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); 28380var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context, out hash); 28383var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, this.context); 28398case SyntaxKind.BoolKeyword: 28399case SyntaxKind.ByteKeyword: 28400case SyntaxKind.SByteKeyword: 28401case SyntaxKind.IntKeyword: 28402case SyntaxKind.UIntKeyword: 28403case SyntaxKind.ShortKeyword: 28404case SyntaxKind.UShortKeyword: 28405case SyntaxKind.LongKeyword: 28406case SyntaxKind.ULongKeyword: 28407case SyntaxKind.FloatKeyword: 28408case SyntaxKind.DoubleKeyword: 28409case SyntaxKind.DecimalKeyword: 28410case SyntaxKind.StringKeyword: 28411case SyntaxKind.CharKeyword: 28412case SyntaxKind.ObjectKeyword: 28413case SyntaxKind.VoidKeyword: break; 28419var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, this.context, out hash); 28422var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword, this.context); 28438var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context, out hash); 28441var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, this.context); 28454if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 28456if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 28460var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context, out hash); 28463var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, this.context); 28477if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 28481var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, this.context, out hash); 28484var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken, this.context); 28497if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 28499if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 28503return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList, this.context); 28510if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 28512if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 28516var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); 28519var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); 28534case SyntaxKind.ManagedKeyword: 28535case SyntaxKind.UnmanagedKeyword: break; 28541var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context, out hash); 28544var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, this.context); 28557if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 28559if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 28563var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context, out hash); 28566var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, this.context); 28579if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 28583var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context, out hash); 28586var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, this.context); 28600if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 28604var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, this.context, out hash); 28607var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken, this.context); 28620if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 28622if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 28626var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context, out hash); 28629var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, this.context); 28646case SyntaxKind.IdentifierToken: 28647case SyntaxKind.None: break; 28654var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, this.context, out hash); 28657var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier, this.context); 28670if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); 28674var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context, out hash); 28677var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, this.context); 28690if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 28695case SyntaxKind.ReadOnlyKeyword: 28696case SyntaxKind.None: break; 28704var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context, out hash); 28707var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, this.context); 28720if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); 28725var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, this.context, out hash); 28728var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type, this.context); 28741if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 28744if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 28748var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context, out hash); 28751var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, this.context); 28764if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 28766if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 28770var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context, out hash); 28773var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, this.context); 28782public PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) 28786case SyntaxKind.UnaryPlusExpression: 28787case SyntaxKind.UnaryMinusExpression: 28788case SyntaxKind.BitwiseNotExpression: 28789case SyntaxKind.LogicalNotExpression: 28790case SyntaxKind.PreIncrementExpression: 28791case SyntaxKind.PreDecrementExpression: 28792case SyntaxKind.AddressOfExpression: 28793case SyntaxKind.PointerIndirectionExpression: 28794case SyntaxKind.IndexExpression: break; 28801case SyntaxKind.PlusToken: 28802case SyntaxKind.MinusToken: 28803case SyntaxKind.TildeToken: 28804case SyntaxKind.ExclamationToken: 28805case SyntaxKind.PlusPlusToken: 28806case SyntaxKind.MinusMinusToken: 28807case SyntaxKind.AmpersandToken: 28808case SyntaxKind.AsteriskToken: 28809case SyntaxKind.CaretToken: break; 28832if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); 28837var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context, out hash); 28840var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression, this.context); 28849public PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) 28853case SyntaxKind.PostIncrementExpression: 28854case SyntaxKind.PostDecrementExpression: 28855case SyntaxKind.SuppressNullableWarningExpression: break; 28863case SyntaxKind.PlusPlusToken: 28864case SyntaxKind.MinusMinusToken: 28865case SyntaxKind.ExclamationToken: break; 28883public MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) 28887case SyntaxKind.SimpleMemberAccessExpression: 28888case SyntaxKind.PointerMemberAccessExpression: break; 28896case SyntaxKind.DotToken: 28897case SyntaxKind.MinusGreaterThanToken: break; 28921if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); 28926var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context, out hash); 28929var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, this.context); 28942if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); 28947var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, this.context, out hash); 28950var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name, this.context); 28966var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, this.context, out hash); 28969var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList, this.context); 28982if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 28986var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context, out hash); 28989var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, this.context); 29005var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, this.context, out hash); 29008var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList, this.context); 29017public BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 29021case SyntaxKind.AddExpression: 29022case SyntaxKind.SubtractExpression: 29023case SyntaxKind.MultiplyExpression: 29024case SyntaxKind.DivideExpression: 29025case SyntaxKind.ModuloExpression: 29026case SyntaxKind.LeftShiftExpression: 29027case SyntaxKind.RightShiftExpression: 29028case SyntaxKind.UnsignedRightShiftExpression: 29029case SyntaxKind.LogicalOrExpression: 29030case SyntaxKind.LogicalAndExpression: 29031case SyntaxKind.BitwiseOrExpression: 29032case SyntaxKind.BitwiseAndExpression: 29033case SyntaxKind.ExclusiveOrExpression: 29034case SyntaxKind.EqualsExpression: 29035case SyntaxKind.NotEqualsExpression: 29036case SyntaxKind.LessThanExpression: 29037case SyntaxKind.LessThanOrEqualExpression: 29038case SyntaxKind.GreaterThanExpression: 29039case SyntaxKind.GreaterThanOrEqualExpression: 29040case SyntaxKind.IsExpression: 29041case SyntaxKind.AsExpression: 29042case SyntaxKind.CoalesceExpression: break; 29050case SyntaxKind.PlusToken: 29051case SyntaxKind.MinusToken: 29052case SyntaxKind.AsteriskToken: 29053case SyntaxKind.SlashToken: 29054case SyntaxKind.PercentToken: 29055case SyntaxKind.LessThanLessThanToken: 29056case SyntaxKind.GreaterThanGreaterThanToken: 29057case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 29058case SyntaxKind.BarBarToken: 29059case SyntaxKind.AmpersandAmpersandToken: 29060case SyntaxKind.BarToken: 29061case SyntaxKind.AmpersandToken: 29062case SyntaxKind.CaretToken: 29063case SyntaxKind.EqualsEqualsToken: 29064case SyntaxKind.ExclamationEqualsToken: 29065case SyntaxKind.LessThanToken: 29066case SyntaxKind.LessThanEqualsToken: 29067case SyntaxKind.GreaterThanToken: 29068case SyntaxKind.GreaterThanEqualsToken: 29069case SyntaxKind.IsKeyword: 29070case SyntaxKind.AsKeyword: 29071case SyntaxKind.QuestionQuestionToken: break; 29090public AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 29094case SyntaxKind.SimpleAssignmentExpression: 29095case SyntaxKind.AddAssignmentExpression: 29096case SyntaxKind.SubtractAssignmentExpression: 29097case SyntaxKind.MultiplyAssignmentExpression: 29098case SyntaxKind.DivideAssignmentExpression: 29099case SyntaxKind.ModuloAssignmentExpression: 29100case SyntaxKind.AndAssignmentExpression: 29101case SyntaxKind.ExclusiveOrAssignmentExpression: 29102case SyntaxKind.OrAssignmentExpression: 29103case SyntaxKind.LeftShiftAssignmentExpression: 29104case SyntaxKind.RightShiftAssignmentExpression: 29105case SyntaxKind.UnsignedRightShiftAssignmentExpression: 29106case SyntaxKind.CoalesceAssignmentExpression: break; 29114case SyntaxKind.EqualsToken: 29115case SyntaxKind.PlusEqualsToken: 29116case SyntaxKind.MinusEqualsToken: 29117case SyntaxKind.AsteriskEqualsToken: 29118case SyntaxKind.SlashEqualsToken: 29119case SyntaxKind.PercentEqualsToken: 29120case SyntaxKind.AmpersandEqualsToken: 29121case SyntaxKind.CaretEqualsToken: 29122case SyntaxKind.BarEqualsToken: 29123case SyntaxKind.LessThanLessThanEqualsToken: 29124case SyntaxKind.GreaterThanGreaterThanEqualsToken: 29125case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 29126case SyntaxKind.QuestionQuestionEqualsToken: break; 29150if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 29153if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 29157return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse, this.context); 29164if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); 29168var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, this.context, out hash); 29171var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token, this.context); 29184if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); 29188var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, this.context, out hash); 29191var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token, this.context); 29200public LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) 29204case SyntaxKind.ArgListExpression: 29205case SyntaxKind.NumericLiteralExpression: 29206case SyntaxKind.StringLiteralExpression: 29207case SyntaxKind.Utf8StringLiteralExpression: 29208case SyntaxKind.CharacterLiteralExpression: 29209case SyntaxKind.TrueLiteralExpression: 29210case SyntaxKind.FalseLiteralExpression: 29211case SyntaxKind.NullLiteralExpression: 29212case SyntaxKind.DefaultLiteralExpression: break; 29219case SyntaxKind.ArgListKeyword: 29220case SyntaxKind.NumericLiteralToken: 29221case SyntaxKind.StringLiteralToken: 29222case SyntaxKind.Utf8StringLiteralToken: 29223case SyntaxKind.MultiLineRawStringLiteralToken: 29224case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 29225case SyntaxKind.SingleLineRawStringLiteralToken: 29226case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 29227case SyntaxKind.CharacterLiteralToken: 29228case SyntaxKind.TrueKeyword: 29229case SyntaxKind.FalseKeyword: 29230case SyntaxKind.NullKeyword: 29231case SyntaxKind.DefaultKeyword: break; 29253if (token.Kind != SyntaxKind.FieldKeyword) throw new ArgumentException(nameof(token)); 29257var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FieldExpression, token, this.context, out hash); 29260var result = new FieldExpressionSyntax(SyntaxKind.FieldExpression, token, this.context); 29273if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); 29275if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29278if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29281return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken, this.context); 29288if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); 29290if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29293if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29296return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken, this.context); 29303if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); 29305if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29308if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); 29311if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29314return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken, this.context); 29317public CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 29321case SyntaxKind.CheckedExpression: 29322case SyntaxKind.UncheckedExpression: break; 29329case SyntaxKind.CheckedKeyword: 29330case SyntaxKind.UncheckedKeyword: break; 29334if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29337if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29347if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 29349if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29352if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29355return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken, this.context); 29362if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); 29364if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29367if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29370return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); 29377if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); 29379if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29382if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29385return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken, this.context); 29396var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, this.context, out hash); 29399var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList, this.context); 29416var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, this.context, out hash); 29419var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList, this.context); 29432if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29434if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29438var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); 29441var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); 29454if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 29456if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 29460var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context, out hash); 29463var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, this.context); 29479case SyntaxKind.RefKeyword: 29480case SyntaxKind.OutKeyword: 29481case SyntaxKind.InKeyword: 29482case SyntaxKind.None: break; 29490var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context, out hash); 29493var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression, this.context); 29510var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, this.context, out hash); 29513var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken, this.context); 29530var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, this.context, out hash); 29533var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken, this.context); 29550var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, this.context, out hash); 29553var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation, this.context); 29566if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 29569if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 29573return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression, this.context); 29580if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 29584return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody, this.context); 29592if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 29595return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody, this.context); 29602if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 29607var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, this.context, out hash); 29610var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression, this.context); 29624if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 29627return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody, this.context); 29630public InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken) 29634case SyntaxKind.ObjectInitializerExpression: 29635case SyntaxKind.CollectionInitializerExpression: 29636case SyntaxKind.ArrayInitializerExpression: 29637case SyntaxKind.ComplexElementInitializerExpression: 29638case SyntaxKind.WithInitializerExpression: break; 29643if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 29645if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 29665if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 29670var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context, out hash); 29673var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, this.context); 29686if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 29690return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer, this.context); 29698if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 29703var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context, out hash); 29706var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer, this.context); 29722var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context, out hash); 29725var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, this.context); 29738if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 29740if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 29742if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 29745return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken, this.context); 29752if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 29757var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context, out hash); 29760var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, this.context); 29773if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 29775if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 29777if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 29781return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer, this.context); 29788if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 29793var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context, out hash); 29796var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, this.context); 29809if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 29811if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 29813if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 29817return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer, this.context); 29824if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 29826if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 29830var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context, out hash); 29833var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, this.context); 29849var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, this.context, out hash); 29852var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression, this.context); 29865if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 29870var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, this.context, out hash); 29873var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression, this.context); 29886if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 29891var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WithElement, withKeyword, argumentList, this.context, out hash); 29894var result = new WithElementSyntax(SyntaxKind.WithElement, withKeyword, argumentList, this.context); 29911var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, this.context, out hash); 29914var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body, this.context); 29930var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context, out hash); 29933var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, this.context); 29946if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); 29948if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 29950if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 29954return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression, this.context); 29961if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); 29963if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 29965if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 29969return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression, this.context); 29976if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); 29978if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 29980if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 29983if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); 29986if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); 29990return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into, this.context); 29997if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 29999if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30003var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context, out hash); 30006var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier, this.context); 30019if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 30024var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, this.context, out hash); 30027var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition, this.context); 30040if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); 30044var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context, out hash); 30047var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, this.context); 30056public OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) 30060case SyntaxKind.AscendingOrdering: 30061case SyntaxKind.DescendingOrdering: break; 30070case SyntaxKind.AscendingKeyword: 30071case SyntaxKind.DescendingKeyword: 30072case SyntaxKind.None: break; 30095if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); 30100var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, this.context, out hash); 30103var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression, this.context); 30116if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); 30119if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); 30123return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression, this.context); 30130if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 30132if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30137var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context, out hash); 30140var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body, this.context); 30153if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); 30157var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context, out hash); 30160var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, this.context); 30175case SyntaxKind.InterpolatedStringStartToken: 30176case SyntaxKind.InterpolatedVerbatimStringStartToken: 30177case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 30178case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; 30184case SyntaxKind.InterpolatedStringEndToken: 30185case SyntaxKind.InterpolatedRawStringEndToken: break; 30191var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context, out hash); 30194var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, this.context); 30208if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); 30213var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context, out hash); 30216var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, this.context); 30229if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 30234var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, this.context, out hash); 30237var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression, this.context); 30250if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 30255var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, this.context, out hash); 30258var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition, this.context); 30271if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 30275var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, this.context, out hash); 30278var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken, this.context); 30295var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, this.context, out hash); 30298var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation, this.context); 30311if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); 30316var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, this.context, out hash); 30319var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation, this.context); 30333return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation, this.context); 30340if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 30342if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 30346var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context, out hash); 30349var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, this.context); 30362if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 30364if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 30368var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context, out hash); 30371var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, this.context); 30387var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, this.context, out hash); 30390var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern, this.context); 30406var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, this.context, out hash); 30409var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression, this.context); 30422if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 30425if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 30429var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context, out hash); 30432var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, this.context); 30447case SyntaxKind.EqualsEqualsToken: 30448case SyntaxKind.ExclamationEqualsToken: 30449case SyntaxKind.LessThanToken: 30450case SyntaxKind.LessThanEqualsToken: 30451case SyntaxKind.GreaterThanToken: 30452case SyntaxKind.GreaterThanEqualsToken: break; 30459var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, this.context, out hash); 30462var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression, this.context); 30478var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, this.context, out hash); 30481var result = new TypePatternSyntax(SyntaxKind.TypePattern, type, this.context); 30490public BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 30494case SyntaxKind.OrPattern: 30495case SyntaxKind.AndPattern: break; 30503case SyntaxKind.OrKeyword: 30504case SyntaxKind.AndKeyword: break; 30527if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); 30532var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, this.context, out hash); 30535var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern, this.context); 30548if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 30550if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 30553return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation, this.context); 30560if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); 30564var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, this.context, out hash); 30567var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern, this.context); 30580if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); 30584var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, this.context, out hash); 30587var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken, this.context); 30600if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 30603if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 30606return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken, this.context); 30617var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context, out hash); 30620var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value, this.context); 30634if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); 30638var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context, out hash); 30641var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, this.context); 30657var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context, out hash); 30660var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, this.context); 30673if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 30675if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 30678return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken, this.context); 30686if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30692case SyntaxKind.SemicolonToken: 30693case SyntaxKind.None: break; 30699return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); 30709case SyntaxKind.AwaitKeyword: 30710case SyntaxKind.None: break; 30718case SyntaxKind.UsingKeyword: 30719case SyntaxKind.None: break; 30725if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 30728return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken, this.context); 30738var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, this.context, out hash); 30741var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node, this.context); 30754if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30758var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context, out hash); 30761var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, this.context); 30774if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 30779var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, this.context, out hash); 30782var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value, this.context); 30795if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30799var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, this.context, out hash); 30802var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier, this.context); 30815if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 30819var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, this.context, out hash); 30822var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken, this.context); 30835if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 30837if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 30841var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context, out hash); 30844var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, this.context); 30858if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 30862var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context, out hash); 30865var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, this.context); 30878if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 30882var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context, out hash); 30885var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, this.context); 30898if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 30900if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 30904return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement, this.context); 30907public GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 30911case SyntaxKind.GotoStatement: 30912case SyntaxKind.GotoCaseStatement: 30913case SyntaxKind.GotoDefaultStatement: break; 30918if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); 30923case SyntaxKind.CaseKeyword: 30924case SyntaxKind.DefaultKeyword: 30925case SyntaxKind.None: break; 30930if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 30940if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); 30942if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 30946var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context, out hash); 30949var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, this.context); 30962if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); 30964if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 30968var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context, out hash); 30971var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, this.context); 30984if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); 30986if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 30989return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken, this.context); 30996if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 30998if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31001return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken, this.context); 31004public YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 31008case SyntaxKind.YieldReturnStatement: 31009case SyntaxKind.YieldBreakStatement: break; 31014if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); 31018case SyntaxKind.ReturnKeyword: 31019case SyntaxKind.BreakKeyword: break; 31023if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31033if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 31035if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31038if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31042return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement, this.context); 31049if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); 31052if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 31054if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31057if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31059if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31062return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken, this.context); 31069if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); 31071if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31073if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); 31075if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); 31077if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31081return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement, this.context); 31091case SyntaxKind.AwaitKeyword: 31092case SyntaxKind.None: break; 31097if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 31099if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31102if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31104if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 31107if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31111return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement, this.context); 31121case SyntaxKind.AwaitKeyword: 31122case SyntaxKind.None: break; 31127if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 31129if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31132if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 31135if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31139return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement, this.context); 31149case SyntaxKind.AwaitKeyword: 31150case SyntaxKind.None: break; 31155if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 31157if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31159if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31163return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement, this.context); 31170if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); 31172if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31175if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31179return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement, this.context); 31182public CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block) 31186case SyntaxKind.CheckedStatement: 31187case SyntaxKind.UncheckedStatement: break; 31194case SyntaxKind.CheckedKeyword: 31195case SyntaxKind.UncheckedKeyword: break; 31218if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); 31223var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context, out hash); 31226var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, this.context); 31239if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); 31241if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31244if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31248return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement, this.context); 31255if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 31257if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31260if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31264return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else, this.context); 31271if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 31276var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, this.context, out hash); 31279var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement, this.context); 31292if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 31297case SyntaxKind.OpenParenToken: 31298case SyntaxKind.None: break; 31307case SyntaxKind.CloseParenToken: 31308case SyntaxKind.None: break; 31313if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 31315if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 31318return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken, this.context); 31327var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context, out hash); 31330var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node, this.context); 31343if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 31348return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken, this.context); 31355if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 31361var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context, out hash); 31364var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, this.context); 31377if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 31382var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context, out hash); 31385var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken, this.context); 31399if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 31401if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 31403if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 31406return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken, this.context); 31414if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); 31418return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression, this.context); 31425if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); 31429return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally, this.context); 31436if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); 31440return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block, this.context); 31447if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31453case SyntaxKind.IdentifierToken: 31454case SyntaxKind.None: break; 31459if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31462return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken, this.context); 31469if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 31471if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31474if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31477return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken, this.context); 31484if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); 31489var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, this.context, out hash); 31492var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block, this.context); 31505if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); 31508return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken, this.context); 31515if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); 31517if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); 31519if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31521if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31524return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken, this.context); 31534case SyntaxKind.GlobalKeyword: 31535case SyntaxKind.None: break; 31540if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 31545case SyntaxKind.StaticKeyword: 31546case SyntaxKind.None: break; 31554case SyntaxKind.UnsafeKeyword: 31555case SyntaxKind.None: break; 31561if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31564return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken, this.context); 31571if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 31574if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 31576if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 31581case SyntaxKind.SemicolonToken: 31582case SyntaxKind.None: break; 31588return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken, this.context); 31595if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 31598if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31601return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node, this.context); 31608if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 31610if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 31613return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken, this.context); 31621if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 31625var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context, out hash); 31628var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, this.context); 31643return new AttributeSyntax(SyntaxKind.Attribute, name, argumentList, this.context); 31650if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 31652if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 31656var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context, out hash); 31659var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, this.context); 31675var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context, out hash); 31678var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, this.context); 31692if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 31696var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, this.context, out hash); 31699var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken, this.context); 31712if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 31714if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 31718var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context, out hash); 31721var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, this.context); 31737case SyntaxKind.InKeyword: 31738case SyntaxKind.OutKeyword: 31739case SyntaxKind.None: break; 31744if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31748var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context, out hash); 31751var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, this.context); 31764if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); 31766if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31771case SyntaxKind.OpenBraceToken: 31772case SyntaxKind.None: break; 31780case SyntaxKind.CloseBraceToken: 31781case SyntaxKind.None: break; 31789case SyntaxKind.SemicolonToken: 31790case SyntaxKind.None: break; 31796return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 31799public StructDeclarationSyntax StructDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, CoreSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 31803case SyntaxKind.StructDeclaration: 31804case SyntaxKind.UnionDeclaration: break; 31811case SyntaxKind.StructKeyword: 31812case SyntaxKind.UnionKeyword: break; 31816if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31821case SyntaxKind.OpenBraceToken: 31822case SyntaxKind.None: break; 31830case SyntaxKind.CloseBraceToken: 31831case SyntaxKind.None: break; 31839case SyntaxKind.SemicolonToken: 31840case SyntaxKind.None: break; 31853if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); 31855if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31860case SyntaxKind.OpenBraceToken: 31861case SyntaxKind.None: break; 31869case SyntaxKind.CloseBraceToken: 31870case SyntaxKind.None: break; 31878case SyntaxKind.SemicolonToken: 31879case SyntaxKind.None: break; 31885return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 31888public 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) 31892case SyntaxKind.RecordDeclaration: 31893case SyntaxKind.RecordStructDeclaration: break; 31902case SyntaxKind.ClassKeyword: 31903case SyntaxKind.StructKeyword: 31904case SyntaxKind.None: break; 31909if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31914case SyntaxKind.OpenBraceToken: 31915case SyntaxKind.None: break; 31923case SyntaxKind.CloseBraceToken: 31924case SyntaxKind.None: break; 31932case SyntaxKind.SemicolonToken: 31933case SyntaxKind.None: break; 31946if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); 31948if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31953case SyntaxKind.OpenBraceToken: 31954case SyntaxKind.None: break; 31962case SyntaxKind.CloseBraceToken: 31963case SyntaxKind.None: break; 31971case SyntaxKind.SemicolonToken: 31972case SyntaxKind.None: break; 31978return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 31985if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 31988if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 31991if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 31994return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken, this.context); 32001if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32004return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue, this.context); 32011if (keyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(keyword)); 32016case SyntaxKind.OpenBraceToken: 32017case SyntaxKind.None: break; 32025case SyntaxKind.CloseBraceToken: 32026case SyntaxKind.None: break; 32034case SyntaxKind.SemicolonToken: 32035case SyntaxKind.None: break; 32041return new ExtensionBlockDeclarationSyntax(SyntaxKind.ExtensionBlockDeclaration, attributeLists.Node, modifiers.Node, keyword, typeParameterList, parameterList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken, this.context); 32048if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 32052var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, this.context, out hash); 32055var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node, this.context); 32071var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, this.context, out hash); 32074var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type, this.context); 32091var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context, out hash); 32094var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList, this.context); 32107if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 32110if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 32113return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node, this.context); 32120if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 32122if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 32124if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 32128var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context, out hash); 32131var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, this.context); 32140public ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) 32144case SyntaxKind.ClassConstraint: 32145case SyntaxKind.StructConstraint: break; 32152case SyntaxKind.ClassKeyword: 32153case SyntaxKind.StructKeyword: break; 32160case SyntaxKind.QuestionToken: 32161case SyntaxKind.None: break; 32187var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, this.context, out hash); 32190var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type, this.context); 32203if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); 32207var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, this.context, out hash); 32210var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword, this.context); 32223if (allowsKeyword.Kind != SyntaxKind.AllowsKeyword) throw new ArgumentException(nameof(allowsKeyword)); 32227var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node, this.context, out hash); 32230var result = new AllowsConstraintClauseSyntax(SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node, this.context); 32243if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 32245if (structKeyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(structKeyword)); 32249var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.RefStructConstraint, refKeyword, structKeyword, this.context, out hash); 32252var result = new RefStructConstraintSyntax(SyntaxKind.RefStructConstraint, refKeyword, structKeyword, this.context); 32266if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 32269return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken, this.context); 32276if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 32279if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 32282return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken, this.context); 32290if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 32294var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context, out hash); 32297var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, this.context); 32311if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32317case SyntaxKind.SemicolonToken: 32318case SyntaxKind.None: break; 32324return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken, this.context); 32332if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 32337case SyntaxKind.CheckedKeyword: 32338case SyntaxKind.None: break; 32345case SyntaxKind.PlusToken: 32346case SyntaxKind.MinusToken: 32347case SyntaxKind.ExclamationToken: 32348case SyntaxKind.TildeToken: 32349case SyntaxKind.PlusPlusToken: 32350case SyntaxKind.MinusMinusToken: 32351case SyntaxKind.AsteriskToken: 32352case SyntaxKind.SlashToken: 32353case SyntaxKind.PercentToken: 32354case SyntaxKind.LessThanLessThanToken: 32355case SyntaxKind.GreaterThanGreaterThanToken: 32356case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 32357case SyntaxKind.BarToken: 32358case SyntaxKind.AmpersandToken: 32359case SyntaxKind.CaretToken: 32360case SyntaxKind.EqualsEqualsToken: 32361case SyntaxKind.ExclamationEqualsToken: 32362case SyntaxKind.LessThanToken: 32363case SyntaxKind.LessThanEqualsToken: 32364case SyntaxKind.GreaterThanToken: 32365case SyntaxKind.GreaterThanEqualsToken: 32366case SyntaxKind.FalseKeyword: 32367case SyntaxKind.TrueKeyword: 32368case SyntaxKind.IsKeyword: 32369case SyntaxKind.PlusEqualsToken: 32370case SyntaxKind.MinusEqualsToken: 32371case SyntaxKind.AsteriskEqualsToken: 32372case SyntaxKind.SlashEqualsToken: 32373case SyntaxKind.PercentEqualsToken: 32374case SyntaxKind.AmpersandEqualsToken: 32375case SyntaxKind.BarEqualsToken: 32376case SyntaxKind.CaretEqualsToken: 32377case SyntaxKind.LessThanLessThanEqualsToken: 32378case SyntaxKind.GreaterThanGreaterThanEqualsToken: 32379case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 32387case SyntaxKind.SemicolonToken: 32388case SyntaxKind.None: break; 32394return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken, this.context); 32403case SyntaxKind.ImplicitKeyword: 32404case SyntaxKind.ExplicitKeyword: break; 32408if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 32413case SyntaxKind.CheckedKeyword: 32414case SyntaxKind.None: break; 32424case SyntaxKind.SemicolonToken: 32425case SyntaxKind.None: break; 32431return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken, this.context); 32438if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32444case SyntaxKind.SemicolonToken: 32445case SyntaxKind.None: break; 32451return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken, this.context); 32454public ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 32458case SyntaxKind.BaseConstructorInitializer: 32459case SyntaxKind.ThisConstructorInitializer: break; 32464if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 32468case SyntaxKind.BaseKeyword: 32469case SyntaxKind.ThisKeyword: break; 32492if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); 32494if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32500case SyntaxKind.SemicolonToken: 32501case SyntaxKind.None: break; 32507return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken, this.context); 32515if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32520case SyntaxKind.SemicolonToken: 32521case SyntaxKind.None: break; 32527return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken, this.context); 32534if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 32539var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context, out hash); 32542var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression, this.context); 32555if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 32558if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 32563case SyntaxKind.SemicolonToken: 32564case SyntaxKind.None: break; 32570return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken, this.context); 32578if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 32584case SyntaxKind.SemicolonToken: 32585case SyntaxKind.None: break; 32591return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken, this.context); 32598if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 32600if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 32604var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context, out hash); 32607var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, this.context); 32616public AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, CoreSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 32620case SyntaxKind.GetAccessorDeclaration: 32621case SyntaxKind.SetAccessorDeclaration: 32622case SyntaxKind.InitAccessorDeclaration: 32623case SyntaxKind.AddAccessorDeclaration: 32624case SyntaxKind.RemoveAccessorDeclaration: 32625case SyntaxKind.UnknownAccessorDeclaration: break; 32632case SyntaxKind.GetKeyword: 32633case SyntaxKind.SetKeyword: 32634case SyntaxKind.InitKeyword: 32635case SyntaxKind.AddKeyword: 32636case SyntaxKind.RemoveKeyword: 32637case SyntaxKind.IdentifierToken: break; 32644case SyntaxKind.SemicolonToken: 32645case SyntaxKind.None: break; 32658if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 32660if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 32664var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); 32667var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, this.context); 32680if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 32682if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 32686var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); 32689var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); 32705case SyntaxKind.IdentifierToken: 32706case SyntaxKind.ArgListKeyword: 32707case SyntaxKind.None: break; 32713return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default, this.context); 32723var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context, out hash); 32726var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, this.context); 32740return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type, this.context); 32748return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node, this.context); 32751public DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment) 32755case SyntaxKind.SingleLineDocumentationCommentTrivia: 32756case SyntaxKind.MultiLineDocumentationCommentTrivia: break; 32761if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); 32774var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, this.context, out hash); 32777var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type, this.context); 32791if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 32796var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, this.context, out hash); 32799var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member, this.context); 32815var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, this.context, out hash); 32818var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters, this.context); 32831if (extensionKeyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(extensionKeyword)); 32834if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 32838return new ExtensionMemberCrefSyntax(SyntaxKind.ExtensionMemberCref, extensionKeyword, typeArgumentList, parameters, dotToken, member, this.context); 32845if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 32849var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context, out hash); 32852var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters, this.context); 32865if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 32870case SyntaxKind.CheckedKeyword: 32871case SyntaxKind.None: break; 32878case SyntaxKind.PlusToken: 32879case SyntaxKind.MinusToken: 32880case SyntaxKind.ExclamationToken: 32881case SyntaxKind.TildeToken: 32882case SyntaxKind.PlusPlusToken: 32883case SyntaxKind.MinusMinusToken: 32884case SyntaxKind.AsteriskToken: 32885case SyntaxKind.SlashToken: 32886case SyntaxKind.PercentToken: 32887case SyntaxKind.LessThanLessThanToken: 32888case SyntaxKind.GreaterThanGreaterThanToken: 32889case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 32890case SyntaxKind.BarToken: 32891case SyntaxKind.AmpersandToken: 32892case SyntaxKind.CaretToken: 32893case SyntaxKind.EqualsEqualsToken: 32894case SyntaxKind.ExclamationEqualsToken: 32895case SyntaxKind.LessThanToken: 32896case SyntaxKind.LessThanEqualsToken: 32897case SyntaxKind.GreaterThanToken: 32898case SyntaxKind.GreaterThanEqualsToken: 32899case SyntaxKind.FalseKeyword: 32900case SyntaxKind.TrueKeyword: 32901case SyntaxKind.PlusEqualsToken: 32902case SyntaxKind.MinusEqualsToken: 32903case SyntaxKind.AsteriskEqualsToken: 32904case SyntaxKind.SlashEqualsToken: 32905case SyntaxKind.PercentEqualsToken: 32906case SyntaxKind.AmpersandEqualsToken: 32907case SyntaxKind.BarEqualsToken: 32908case SyntaxKind.CaretEqualsToken: 32909case SyntaxKind.LessThanLessThanEqualsToken: 32910case SyntaxKind.GreaterThanGreaterThanEqualsToken: 32911case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 32916return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters, this.context); 32925case SyntaxKind.ImplicitKeyword: 32926case SyntaxKind.ExplicitKeyword: break; 32930if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 32935case SyntaxKind.CheckedKeyword: 32936case SyntaxKind.None: break; 32943return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters, this.context); 32950if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 32952if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 32956var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context, out hash); 32959var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, this.context); 32972if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 32974if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 32978var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context, out hash); 32981var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, this.context); 32997case SyntaxKind.RefKeyword: 32998case SyntaxKind.OutKeyword: 32999case SyntaxKind.InKeyword: 33000case SyntaxKind.None: break; 33008case SyntaxKind.ReadOnlyKeyword: 33009case SyntaxKind.None: break; 33017var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context, out hash); 33020var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, this.context); 33037var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context, out hash); 33040var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag, this.context); 33053if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 33056if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 33059return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken, this.context); 33066if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); 33069if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 33073var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context, out hash); 33076var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, this.context); 33089if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 33092if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); 33095return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken, this.context); 33102if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); 33106var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, this.context, out hash); 33109var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName, this.context); 33122if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); 33124if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 33128var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, this.context, out hash); 33131var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken, this.context); 33145if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 33149case SyntaxKind.SingleQuoteToken: 33150case SyntaxKind.DoubleQuoteToken: break; 33156case SyntaxKind.SingleQuoteToken: 33157case SyntaxKind.DoubleQuoteToken: break; 33162return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken, this.context); 33170if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 33174case SyntaxKind.SingleQuoteToken: 33175case SyntaxKind.DoubleQuoteToken: break; 33182case SyntaxKind.SingleQuoteToken: 33183case SyntaxKind.DoubleQuoteToken: break; 33188return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken, this.context); 33196if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 33200case SyntaxKind.SingleQuoteToken: 33201case SyntaxKind.DoubleQuoteToken: break; 33208case SyntaxKind.SingleQuoteToken: 33209case SyntaxKind.DoubleQuoteToken: break; 33214return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken, this.context); 33223var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, this.context, out hash); 33226var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node, this.context); 33239if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); 33241if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); 33245var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context, out hash); 33248var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, this.context); 33261if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); 33264if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); 33267return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken, this.context); 33274if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); 33276if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); 33280var cached = CSharpSyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context, out hash); 33283var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, this.context); 33296if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33298if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 33301if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33304return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); 33311if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33313if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); 33316if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33319return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue, this.context); 33326if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33328if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 33330if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33333return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken, this.context); 33340if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33342if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); 33344if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33347return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive, this.context); 33354if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33356if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); 33358if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33361return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive, this.context); 33368if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33370if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); 33372if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33375return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive, this.context); 33382if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33384if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); 33386if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33389return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive, this.context); 33396if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33398if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 33400if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33403return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive, this.context); 33410if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33413if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33416return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive, this.context); 33423if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33425if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); 33427if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 33429if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33432return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive, this.context); 33439if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33441if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); 33443if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 33445if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33448return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive, this.context); 33455if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33457if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 33461case SyntaxKind.NumericLiteralToken: 33462case SyntaxKind.DefaultKeyword: 33463case SyntaxKind.HiddenKeyword: break; 33470case SyntaxKind.StringLiteralToken: 33471case SyntaxKind.None: break; 33476if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33479return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive, this.context); 33486if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 33488if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); 33490if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); 33492if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); 33494if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 33497return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken, this.context); 33504if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33506if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 33509if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); 33515case SyntaxKind.NumericLiteralToken: 33516case SyntaxKind.None: break; 33521if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 33523if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33526return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive, this.context); 33533if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33535if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 33537if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 33541case SyntaxKind.DisableKeyword: 33542case SyntaxKind.RestoreKeyword: break; 33546if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33549return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive, this.context); 33556if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33558if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 33560if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); 33562if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 33564if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); 33566if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); 33568if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33571return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive, this.context); 33578if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33580if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); 33582if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 33584if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33587return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive, this.context); 33594if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33596if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); 33598if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 33600if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33603return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive, this.context); 33610if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33612if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); 33614if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33617return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive, this.context); 33624if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33626if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 33631case SyntaxKind.StringLiteralToken: 33632case SyntaxKind.None: break; 33637if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33640return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, content, endOfDirectiveToken, isActive, this.context); 33647if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 33649if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); 33653case SyntaxKind.EnableKeyword: 33654case SyntaxKind.DisableKeyword: 33655case SyntaxKind.RestoreKeyword: break; 33662case SyntaxKind.WarningsKeyword: 33663case SyntaxKind.AnnotationsKeyword: 33664case SyntaxKind.None: break; 33669if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 33672return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive, this.context); 33685case SyntaxKind.IdentifierToken: 33686case SyntaxKind.GlobalKeyword: break; 33692var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IdentifierName, identifier, out hash); 33695var result = new IdentifierNameSyntax(SyntaxKind.IdentifierName, identifier); 33709if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 33714var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedName, left, dotToken, right, out hash); 33717var result = new QualifiedNameSyntax(SyntaxKind.QualifiedName, left, dotToken, right); 33730if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 33735var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GenericName, identifier, typeArgumentList, out hash); 33738var result = new GenericNameSyntax(SyntaxKind.GenericName, identifier, typeArgumentList); 33751if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 33753if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 33757var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken, out hash); 33760var result = new TypeArgumentListSyntax(SyntaxKind.TypeArgumentList, lessThanToken, arguments.Node, greaterThanToken); 33774if (colonColonToken.Kind != SyntaxKind.ColonColonToken) throw new ArgumentException(nameof(colonColonToken)); 33779var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AliasQualifiedName, alias, colonColonToken, name, out hash); 33782var result = new AliasQualifiedNameSyntax(SyntaxKind.AliasQualifiedName, alias, colonColonToken, name); 33797case SyntaxKind.BoolKeyword: 33798case SyntaxKind.ByteKeyword: 33799case SyntaxKind.SByteKeyword: 33800case SyntaxKind.IntKeyword: 33801case SyntaxKind.UIntKeyword: 33802case SyntaxKind.ShortKeyword: 33803case SyntaxKind.UShortKeyword: 33804case SyntaxKind.LongKeyword: 33805case SyntaxKind.ULongKeyword: 33806case SyntaxKind.FloatKeyword: 33807case SyntaxKind.DoubleKeyword: 33808case SyntaxKind.DecimalKeyword: 33809case SyntaxKind.StringKeyword: 33810case SyntaxKind.CharKeyword: 33811case SyntaxKind.ObjectKeyword: 33812case SyntaxKind.VoidKeyword: break; 33818var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PredefinedType, keyword, out hash); 33821var result = new PredefinedTypeSyntax(SyntaxKind.PredefinedType, keyword); 33837var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayType, elementType, rankSpecifiers.Node, out hash); 33840var result = new ArrayTypeSyntax(SyntaxKind.ArrayType, elementType, rankSpecifiers.Node); 33853if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 33855if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 33859var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken, out hash); 33862var result = new ArrayRankSpecifierSyntax(SyntaxKind.ArrayRankSpecifier, openBracketToken, sizes.Node, closeBracketToken); 33876if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 33880var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PointerType, elementType, asteriskToken, out hash); 33883var result = new PointerTypeSyntax(SyntaxKind.PointerType, elementType, asteriskToken); 33896if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 33898if (asteriskToken.Kind != SyntaxKind.AsteriskToken) throw new ArgumentException(nameof(asteriskToken)); 33902return new FunctionPointerTypeSyntax(SyntaxKind.FunctionPointerType, delegateKeyword, asteriskToken, callingConvention, parameterList); 33909if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 33911if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 33915var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); 33918var result = new FunctionPointerParameterListSyntax(SyntaxKind.FunctionPointerParameterList, lessThanToken, parameters.Node, greaterThanToken); 33933case SyntaxKind.ManagedKeyword: 33934case SyntaxKind.UnmanagedKeyword: break; 33940var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList, out hash); 33943var result = new FunctionPointerCallingConventionSyntax(SyntaxKind.FunctionPointerCallingConvention, managedOrUnmanagedKeyword, unmanagedCallingConventionList); 33956if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 33958if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 33962var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken, out hash); 33965var result = new FunctionPointerUnmanagedCallingConventionListSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConventionList, openBracketToken, callingConventions.Node, closeBracketToken); 33978if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 33982var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerUnmanagedCallingConvention, name, out hash); 33985var result = new FunctionPointerUnmanagedCallingConventionSyntax(SyntaxKind.FunctionPointerUnmanagedCallingConvention, name); 33999if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 34003var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NullableType, elementType, questionToken, out hash); 34006var result = new NullableTypeSyntax(SyntaxKind.NullableType, elementType, questionToken); 34019if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34021if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34025var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken, out hash); 34028var result = new TupleTypeSyntax(SyntaxKind.TupleType, openParenToken, elements.Node, closeParenToken); 34045case SyntaxKind.IdentifierToken: 34046case SyntaxKind.None: break; 34053var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleElement, type, identifier, out hash); 34056var result = new TupleElementSyntax(SyntaxKind.TupleElement, type, identifier); 34069if (omittedTypeArgumentToken.Kind != SyntaxKind.OmittedTypeArgumentToken) throw new ArgumentException(nameof(omittedTypeArgumentToken)); 34073var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken, out hash); 34076var result = new OmittedTypeArgumentSyntax(SyntaxKind.OmittedTypeArgument, omittedTypeArgumentToken); 34089if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 34094case SyntaxKind.ReadOnlyKeyword: 34095case SyntaxKind.None: break; 34103var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefType, refKeyword, readOnlyKeyword, type, out hash); 34106var result = new RefTypeSyntax(SyntaxKind.RefType, refKeyword, readOnlyKeyword, type); 34119if (scopedKeyword.Kind != SyntaxKind.ScopedKeyword) throw new ArgumentException(nameof(scopedKeyword)); 34124var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ScopedType, scopedKeyword, type, out hash); 34127var result = new ScopedTypeSyntax(SyntaxKind.ScopedType, scopedKeyword, type); 34140if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34143if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34147var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken, out hash); 34150var result = new ParenthesizedExpressionSyntax(SyntaxKind.ParenthesizedExpression, openParenToken, expression, closeParenToken); 34163if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34165if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34169var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken, out hash); 34172var result = new TupleExpressionSyntax(SyntaxKind.TupleExpression, openParenToken, arguments.Node, closeParenToken); 34181public static PrefixUnaryExpressionSyntax PrefixUnaryExpression(SyntaxKind kind, SyntaxToken operatorToken, ExpressionSyntax operand) 34185case SyntaxKind.UnaryPlusExpression: 34186case SyntaxKind.UnaryMinusExpression: 34187case SyntaxKind.BitwiseNotExpression: 34188case SyntaxKind.LogicalNotExpression: 34189case SyntaxKind.PreIncrementExpression: 34190case SyntaxKind.PreDecrementExpression: 34191case SyntaxKind.AddressOfExpression: 34192case SyntaxKind.PointerIndirectionExpression: 34193case SyntaxKind.IndexExpression: break; 34200case SyntaxKind.PlusToken: 34201case SyntaxKind.MinusToken: 34202case SyntaxKind.TildeToken: 34203case SyntaxKind.ExclamationToken: 34204case SyntaxKind.PlusPlusToken: 34205case SyntaxKind.MinusMinusToken: 34206case SyntaxKind.AmpersandToken: 34207case SyntaxKind.AsteriskToken: 34208case SyntaxKind.CaretToken: break; 34231if (awaitKeyword.Kind != SyntaxKind.AwaitKeyword) throw new ArgumentException(nameof(awaitKeyword)); 34236var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AwaitExpression, awaitKeyword, expression, out hash); 34239var result = new AwaitExpressionSyntax(SyntaxKind.AwaitExpression, awaitKeyword, expression); 34248public static PostfixUnaryExpressionSyntax PostfixUnaryExpression(SyntaxKind kind, ExpressionSyntax operand, SyntaxToken operatorToken) 34252case SyntaxKind.PostIncrementExpression: 34253case SyntaxKind.PostDecrementExpression: 34254case SyntaxKind.SuppressNullableWarningExpression: break; 34262case SyntaxKind.PlusPlusToken: 34263case SyntaxKind.MinusMinusToken: 34264case SyntaxKind.ExclamationToken: break; 34282public static MemberAccessExpressionSyntax MemberAccessExpression(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name) 34286case SyntaxKind.SimpleMemberAccessExpression: 34287case SyntaxKind.PointerMemberAccessExpression: break; 34295case SyntaxKind.DotToken: 34296case SyntaxKind.MinusGreaterThanToken: break; 34320if (operatorToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(operatorToken)); 34325var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull, out hash); 34328var result = new ConditionalAccessExpressionSyntax(SyntaxKind.ConditionalAccessExpression, expression, operatorToken, whenNotNull); 34341if (operatorToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(operatorToken)); 34346var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.MemberBindingExpression, operatorToken, name, out hash); 34349var result = new MemberBindingExpressionSyntax(SyntaxKind.MemberBindingExpression, operatorToken, name); 34365var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementBindingExpression, argumentList, out hash); 34368var result = new ElementBindingExpressionSyntax(SyntaxKind.ElementBindingExpression, argumentList); 34381if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 34385var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand, out hash); 34388var result = new RangeExpressionSyntax(SyntaxKind.RangeExpression, leftOperand, operatorToken, rightOperand); 34404var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitElementAccess, argumentList, out hash); 34407var result = new ImplicitElementAccessSyntax(SyntaxKind.ImplicitElementAccess, argumentList); 34416public static BinaryExpressionSyntax BinaryExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 34420case SyntaxKind.AddExpression: 34421case SyntaxKind.SubtractExpression: 34422case SyntaxKind.MultiplyExpression: 34423case SyntaxKind.DivideExpression: 34424case SyntaxKind.ModuloExpression: 34425case SyntaxKind.LeftShiftExpression: 34426case SyntaxKind.RightShiftExpression: 34427case SyntaxKind.UnsignedRightShiftExpression: 34428case SyntaxKind.LogicalOrExpression: 34429case SyntaxKind.LogicalAndExpression: 34430case SyntaxKind.BitwiseOrExpression: 34431case SyntaxKind.BitwiseAndExpression: 34432case SyntaxKind.ExclusiveOrExpression: 34433case SyntaxKind.EqualsExpression: 34434case SyntaxKind.NotEqualsExpression: 34435case SyntaxKind.LessThanExpression: 34436case SyntaxKind.LessThanOrEqualExpression: 34437case SyntaxKind.GreaterThanExpression: 34438case SyntaxKind.GreaterThanOrEqualExpression: 34439case SyntaxKind.IsExpression: 34440case SyntaxKind.AsExpression: 34441case SyntaxKind.CoalesceExpression: break; 34449case SyntaxKind.PlusToken: 34450case SyntaxKind.MinusToken: 34451case SyntaxKind.AsteriskToken: 34452case SyntaxKind.SlashToken: 34453case SyntaxKind.PercentToken: 34454case SyntaxKind.LessThanLessThanToken: 34455case SyntaxKind.GreaterThanGreaterThanToken: 34456case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 34457case SyntaxKind.BarBarToken: 34458case SyntaxKind.AmpersandAmpersandToken: 34459case SyntaxKind.BarToken: 34460case SyntaxKind.AmpersandToken: 34461case SyntaxKind.CaretToken: 34462case SyntaxKind.EqualsEqualsToken: 34463case SyntaxKind.ExclamationEqualsToken: 34464case SyntaxKind.LessThanToken: 34465case SyntaxKind.LessThanEqualsToken: 34466case SyntaxKind.GreaterThanToken: 34467case SyntaxKind.GreaterThanEqualsToken: 34468case SyntaxKind.IsKeyword: 34469case SyntaxKind.AsKeyword: 34470case SyntaxKind.QuestionQuestionToken: break; 34489public static AssignmentExpressionSyntax AssignmentExpression(SyntaxKind kind, ExpressionSyntax left, SyntaxToken operatorToken, ExpressionSyntax right) 34493case SyntaxKind.SimpleAssignmentExpression: 34494case SyntaxKind.AddAssignmentExpression: 34495case SyntaxKind.SubtractAssignmentExpression: 34496case SyntaxKind.MultiplyAssignmentExpression: 34497case SyntaxKind.DivideAssignmentExpression: 34498case SyntaxKind.ModuloAssignmentExpression: 34499case SyntaxKind.AndAssignmentExpression: 34500case SyntaxKind.ExclusiveOrAssignmentExpression: 34501case SyntaxKind.OrAssignmentExpression: 34502case SyntaxKind.LeftShiftAssignmentExpression: 34503case SyntaxKind.RightShiftAssignmentExpression: 34504case SyntaxKind.UnsignedRightShiftAssignmentExpression: 34505case SyntaxKind.CoalesceAssignmentExpression: break; 34513case SyntaxKind.EqualsToken: 34514case SyntaxKind.PlusEqualsToken: 34515case SyntaxKind.MinusEqualsToken: 34516case SyntaxKind.AsteriskEqualsToken: 34517case SyntaxKind.SlashEqualsToken: 34518case SyntaxKind.PercentEqualsToken: 34519case SyntaxKind.AmpersandEqualsToken: 34520case SyntaxKind.CaretEqualsToken: 34521case SyntaxKind.BarEqualsToken: 34522case SyntaxKind.LessThanLessThanEqualsToken: 34523case SyntaxKind.GreaterThanGreaterThanEqualsToken: 34524case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 34525case SyntaxKind.QuestionQuestionEqualsToken: break; 34549if (questionToken.Kind != SyntaxKind.QuestionToken) throw new ArgumentException(nameof(questionToken)); 34552if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 34556return new ConditionalExpressionSyntax(SyntaxKind.ConditionalExpression, condition, questionToken, whenTrue, colonToken, whenFalse); 34563if (token.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(token)); 34567var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThisExpression, token, out hash); 34570var result = new ThisExpressionSyntax(SyntaxKind.ThisExpression, token); 34583if (token.Kind != SyntaxKind.BaseKeyword) throw new ArgumentException(nameof(token)); 34587var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseExpression, token, out hash); 34590var result = new BaseExpressionSyntax(SyntaxKind.BaseExpression, token); 34599public static LiteralExpressionSyntax LiteralExpression(SyntaxKind kind, SyntaxToken token) 34603case SyntaxKind.ArgListExpression: 34604case SyntaxKind.NumericLiteralExpression: 34605case SyntaxKind.StringLiteralExpression: 34606case SyntaxKind.Utf8StringLiteralExpression: 34607case SyntaxKind.CharacterLiteralExpression: 34608case SyntaxKind.TrueLiteralExpression: 34609case SyntaxKind.FalseLiteralExpression: 34610case SyntaxKind.NullLiteralExpression: 34611case SyntaxKind.DefaultLiteralExpression: break; 34618case SyntaxKind.ArgListKeyword: 34619case SyntaxKind.NumericLiteralToken: 34620case SyntaxKind.StringLiteralToken: 34621case SyntaxKind.Utf8StringLiteralToken: 34622case SyntaxKind.MultiLineRawStringLiteralToken: 34623case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 34624case SyntaxKind.SingleLineRawStringLiteralToken: 34625case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 34626case SyntaxKind.CharacterLiteralToken: 34627case SyntaxKind.TrueKeyword: 34628case SyntaxKind.FalseKeyword: 34629case SyntaxKind.NullKeyword: 34630case SyntaxKind.DefaultKeyword: break; 34652if (token.Kind != SyntaxKind.FieldKeyword) throw new ArgumentException(nameof(token)); 34656var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FieldExpression, token, out hash); 34659var result = new FieldExpressionSyntax(SyntaxKind.FieldExpression, token); 34672if (keyword.Kind != SyntaxKind.MakeRefKeyword) throw new ArgumentException(nameof(keyword)); 34674if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34677if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34680return new MakeRefExpressionSyntax(SyntaxKind.MakeRefExpression, keyword, openParenToken, expression, closeParenToken); 34687if (keyword.Kind != SyntaxKind.RefTypeKeyword) throw new ArgumentException(nameof(keyword)); 34689if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34692if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34695return new RefTypeExpressionSyntax(SyntaxKind.RefTypeExpression, keyword, openParenToken, expression, closeParenToken); 34702if (keyword.Kind != SyntaxKind.RefValueKeyword) throw new ArgumentException(nameof(keyword)); 34704if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34707if (comma.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(comma)); 34710if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34713return new RefValueExpressionSyntax(SyntaxKind.RefValueExpression, keyword, openParenToken, expression, comma, type, closeParenToken); 34716public static CheckedExpressionSyntax CheckedExpression(SyntaxKind kind, SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, SyntaxToken closeParenToken) 34720case SyntaxKind.CheckedExpression: 34721case SyntaxKind.UncheckedExpression: break; 34728case SyntaxKind.CheckedKeyword: 34729case SyntaxKind.UncheckedKeyword: break; 34733if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34736if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34746if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 34748if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34751if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34754return new DefaultExpressionSyntax(SyntaxKind.DefaultExpression, keyword, openParenToken, type, closeParenToken); 34761if (keyword.Kind != SyntaxKind.TypeOfKeyword) throw new ArgumentException(nameof(keyword)); 34763if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34766if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34769return new TypeOfExpressionSyntax(SyntaxKind.TypeOfExpression, keyword, openParenToken, type, closeParenToken); 34776if (keyword.Kind != SyntaxKind.SizeOfKeyword) throw new ArgumentException(nameof(keyword)); 34778if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34781if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34784return new SizeOfExpressionSyntax(SyntaxKind.SizeOfExpression, keyword, openParenToken, type, closeParenToken); 34795var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InvocationExpression, expression, argumentList, out hash); 34798var result = new InvocationExpressionSyntax(SyntaxKind.InvocationExpression, expression, argumentList); 34815var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElementAccessExpression, expression, argumentList, out hash); 34818var result = new ElementAccessExpressionSyntax(SyntaxKind.ElementAccessExpression, expression, argumentList); 34831if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34833if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34837var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); 34840var result = new ArgumentListSyntax(SyntaxKind.ArgumentList, openParenToken, arguments.Node, closeParenToken); 34853if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 34855if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 34859var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken, out hash); 34862var result = new BracketedArgumentListSyntax(SyntaxKind.BracketedArgumentList, openBracketToken, arguments.Node, closeBracketToken); 34878case SyntaxKind.RefKeyword: 34879case SyntaxKind.OutKeyword: 34880case SyntaxKind.InKeyword: 34881case SyntaxKind.None: break; 34889var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Argument, nameColon, refKindKeyword, expression, out hash); 34892var result = new ArgumentSyntax(SyntaxKind.Argument, nameColon, refKindKeyword, expression); 34909var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionColon, expression, colonToken, out hash); 34912var result = new ExpressionColonSyntax(SyntaxKind.ExpressionColon, expression, colonToken); 34929var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameColon, name, colonToken, out hash); 34932var result = new NameColonSyntax(SyntaxKind.NameColon, name, colonToken); 34949var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationExpression, type, designation, out hash); 34952var result = new DeclarationExpressionSyntax(SyntaxKind.DeclarationExpression, type, designation); 34965if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 34968if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 34972return new CastExpressionSyntax(SyntaxKind.CastExpression, openParenToken, type, closeParenToken, expression); 34979if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 34983return new AnonymousMethodExpressionSyntax(SyntaxKind.AnonymousMethodExpression, modifiers.Node, delegateKeyword, parameterList, block, expressionBody); 34991if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 34994return new SimpleLambdaExpressionSyntax(SyntaxKind.SimpleLambdaExpression, attributeLists.Node, modifiers.Node, parameter, arrowToken, block, expressionBody); 35001if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 35006var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefExpression, refKeyword, expression, out hash); 35009var result = new RefExpressionSyntax(SyntaxKind.RefExpression, refKeyword, expression); 35023if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 35026return new ParenthesizedLambdaExpressionSyntax(SyntaxKind.ParenthesizedLambdaExpression, attributeLists.Node, modifiers.Node, returnType, parameterList, arrowToken, block, expressionBody); 35029public static InitializerExpressionSyntax InitializerExpression(SyntaxKind kind, SyntaxToken openBraceToken, CoreSyntax.SeparatedSyntaxList<ExpressionSyntax> expressions, SyntaxToken closeBraceToken) 35033case SyntaxKind.ObjectInitializerExpression: 35034case SyntaxKind.CollectionInitializerExpression: 35035case SyntaxKind.ArrayInitializerExpression: 35036case SyntaxKind.ComplexElementInitializerExpression: 35037case SyntaxKind.WithInitializerExpression: break; 35042if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 35044if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 35064if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35069var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer, out hash); 35072var result = new ImplicitObjectCreationExpressionSyntax(SyntaxKind.ImplicitObjectCreationExpression, newKeyword, argumentList, initializer); 35085if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35089return new ObjectCreationExpressionSyntax(SyntaxKind.ObjectCreationExpression, newKeyword, type, argumentList, initializer); 35097if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 35102var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithExpression, expression, withKeyword, initializer, out hash); 35105var result = new WithExpressionSyntax(SyntaxKind.WithExpression, expression, withKeyword, initializer); 35121var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression, out hash); 35124var result = new AnonymousObjectMemberDeclaratorSyntax(SyntaxKind.AnonymousObjectMemberDeclarator, nameEquals, expression); 35137if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35139if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 35141if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 35144return new AnonymousObjectCreationExpressionSyntax(SyntaxKind.AnonymousObjectCreationExpression, newKeyword, openBraceToken, initializers.Node, closeBraceToken); 35151if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35156var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer, out hash); 35159var result = new ArrayCreationExpressionSyntax(SyntaxKind.ArrayCreationExpression, newKeyword, type, initializer); 35172if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 35174if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35176if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35180return new ImplicitArrayCreationExpressionSyntax(SyntaxKind.ImplicitArrayCreationExpression, newKeyword, openBracketToken, commas.Node, closeBracketToken, initializer); 35187if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 35192var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer, out hash); 35195var result = new StackAllocArrayCreationExpressionSyntax(SyntaxKind.StackAllocArrayCreationExpression, stackAllocKeyword, type, initializer); 35208if (stackAllocKeyword.Kind != SyntaxKind.StackAllocKeyword) throw new ArgumentException(nameof(stackAllocKeyword)); 35210if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35212if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35216return new ImplicitStackAllocArrayCreationExpressionSyntax(SyntaxKind.ImplicitStackAllocArrayCreationExpression, stackAllocKeyword, openBracketToken, closeBracketToken, initializer); 35223if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35225if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35229var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken, out hash); 35232var result = new CollectionExpressionSyntax(SyntaxKind.CollectionExpression, openBracketToken, elements.Node, closeBracketToken); 35248var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionElement, expression, out hash); 35251var result = new ExpressionElementSyntax(SyntaxKind.ExpressionElement, expression); 35264if (operatorToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(operatorToken)); 35269var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SpreadElement, operatorToken, expression, out hash); 35272var result = new SpreadElementSyntax(SyntaxKind.SpreadElement, operatorToken, expression); 35285if (withKeyword.Kind != SyntaxKind.WithKeyword) throw new ArgumentException(nameof(withKeyword)); 35290var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WithElement, withKeyword, argumentList, out hash); 35293var result = new WithElementSyntax(SyntaxKind.WithElement, withKeyword, argumentList); 35310var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryExpression, fromClause, body, out hash); 35313var result = new QueryExpressionSyntax(SyntaxKind.QueryExpression, fromClause, body); 35329var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation, out hash); 35332var result = new QueryBodySyntax(SyntaxKind.QueryBody, clauses.Node, selectOrGroup, continuation); 35345if (fromKeyword.Kind != SyntaxKind.FromKeyword) throw new ArgumentException(nameof(fromKeyword)); 35347if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35349if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 35353return new FromClauseSyntax(SyntaxKind.FromClause, fromKeyword, type, identifier, inKeyword, expression); 35360if (letKeyword.Kind != SyntaxKind.LetKeyword) throw new ArgumentException(nameof(letKeyword)); 35362if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35364if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 35368return new LetClauseSyntax(SyntaxKind.LetClause, letKeyword, identifier, equalsToken, expression); 35375if (joinKeyword.Kind != SyntaxKind.JoinKeyword) throw new ArgumentException(nameof(joinKeyword)); 35377if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35379if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 35382if (onKeyword.Kind != SyntaxKind.OnKeyword) throw new ArgumentException(nameof(onKeyword)); 35385if (equalsKeyword.Kind != SyntaxKind.EqualsKeyword) throw new ArgumentException(nameof(equalsKeyword)); 35389return new JoinClauseSyntax(SyntaxKind.JoinClause, joinKeyword, type, identifier, inKeyword, inExpression, onKeyword, leftExpression, equalsKeyword, rightExpression, into); 35396if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 35398if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35402var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.JoinIntoClause, intoKeyword, identifier, out hash); 35405var result = new JoinIntoClauseSyntax(SyntaxKind.JoinIntoClause, intoKeyword, identifier); 35418if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 35423var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhereClause, whereKeyword, condition, out hash); 35426var result = new WhereClauseSyntax(SyntaxKind.WhereClause, whereKeyword, condition); 35439if (orderByKeyword.Kind != SyntaxKind.OrderByKeyword) throw new ArgumentException(nameof(orderByKeyword)); 35443var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OrderByClause, orderByKeyword, orderings.Node, out hash); 35446var result = new OrderByClauseSyntax(SyntaxKind.OrderByClause, orderByKeyword, orderings.Node); 35455public static OrderingSyntax Ordering(SyntaxKind kind, ExpressionSyntax expression, SyntaxToken? ascendingOrDescendingKeyword) 35459case SyntaxKind.AscendingOrdering: 35460case SyntaxKind.DescendingOrdering: break; 35469case SyntaxKind.AscendingKeyword: 35470case SyntaxKind.DescendingKeyword: 35471case SyntaxKind.None: break; 35494if (selectKeyword.Kind != SyntaxKind.SelectKeyword) throw new ArgumentException(nameof(selectKeyword)); 35499var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SelectClause, selectKeyword, expression, out hash); 35502var result = new SelectClauseSyntax(SyntaxKind.SelectClause, selectKeyword, expression); 35515if (groupKeyword.Kind != SyntaxKind.GroupKeyword) throw new ArgumentException(nameof(groupKeyword)); 35518if (byKeyword.Kind != SyntaxKind.ByKeyword) throw new ArgumentException(nameof(byKeyword)); 35522return new GroupClauseSyntax(SyntaxKind.GroupClause, groupKeyword, groupExpression, byKeyword, byExpression); 35529if (intoKeyword.Kind != SyntaxKind.IntoKeyword) throw new ArgumentException(nameof(intoKeyword)); 35531if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 35536var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QueryContinuation, intoKeyword, identifier, body, out hash); 35539var result = new QueryContinuationSyntax(SyntaxKind.QueryContinuation, intoKeyword, identifier, body); 35552if (omittedArraySizeExpressionToken.Kind != SyntaxKind.OmittedArraySizeExpressionToken) throw new ArgumentException(nameof(omittedArraySizeExpressionToken)); 35556var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken, out hash); 35559var result = new OmittedArraySizeExpressionSyntax(SyntaxKind.OmittedArraySizeExpression, omittedArraySizeExpressionToken); 35574case SyntaxKind.InterpolatedStringStartToken: 35575case SyntaxKind.InterpolatedVerbatimStringStartToken: 35576case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 35577case SyntaxKind.InterpolatedMultiLineRawStringStartToken: break; 35583case SyntaxKind.InterpolatedStringEndToken: 35584case SyntaxKind.InterpolatedRawStringEndToken: break; 35590var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken, out hash); 35593var result = new InterpolatedStringExpressionSyntax(SyntaxKind.InterpolatedStringExpression, stringStartToken, contents.Node, stringEndToken); 35607if (isKeyword.Kind != SyntaxKind.IsKeyword) throw new ArgumentException(nameof(isKeyword)); 35612var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IsPatternExpression, expression, isKeyword, pattern, out hash); 35615var result = new IsPatternExpressionSyntax(SyntaxKind.IsPatternExpression, expression, isKeyword, pattern); 35628if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 35633var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ThrowExpression, throwKeyword, expression, out hash); 35636var result = new ThrowExpressionSyntax(SyntaxKind.ThrowExpression, throwKeyword, expression); 35649if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 35654var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.WhenClause, whenKeyword, condition, out hash); 35657var result = new WhenClauseSyntax(SyntaxKind.WhenClause, whenKeyword, condition); 35670if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 35674var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardPattern, underscoreToken, out hash); 35677var result = new DiscardPatternSyntax(SyntaxKind.DiscardPattern, underscoreToken); 35694var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DeclarationPattern, type, designation, out hash); 35697var result = new DeclarationPatternSyntax(SyntaxKind.DeclarationPattern, type, designation); 35710if (varKeyword.Kind != SyntaxKind.VarKeyword) throw new ArgumentException(nameof(varKeyword)); 35715var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VarPattern, varKeyword, designation, out hash); 35718var result = new VarPatternSyntax(SyntaxKind.VarPattern, varKeyword, designation); 35732return new RecursivePatternSyntax(SyntaxKind.RecursivePattern, type, positionalPatternClause, propertyPatternClause, designation); 35739if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35741if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35745var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken, out hash); 35748var result = new PositionalPatternClauseSyntax(SyntaxKind.PositionalPatternClause, openParenToken, subpatterns.Node, closeParenToken); 35761if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 35763if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 35767var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken, out hash); 35770var result = new PropertyPatternClauseSyntax(SyntaxKind.PropertyPatternClause, openBraceToken, subpatterns.Node, closeBraceToken); 35786var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.Subpattern, expressionColon, pattern, out hash); 35789var result = new SubpatternSyntax(SyntaxKind.Subpattern, expressionColon, pattern); 35805var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstantPattern, expression, out hash); 35808var result = new ConstantPatternSyntax(SyntaxKind.ConstantPattern, expression); 35821if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 35824if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 35828var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken, out hash); 35831var result = new ParenthesizedPatternSyntax(SyntaxKind.ParenthesizedPattern, openParenToken, pattern, closeParenToken); 35846case SyntaxKind.EqualsEqualsToken: 35847case SyntaxKind.ExclamationEqualsToken: 35848case SyntaxKind.LessThanToken: 35849case SyntaxKind.LessThanEqualsToken: 35850case SyntaxKind.GreaterThanToken: 35851case SyntaxKind.GreaterThanEqualsToken: break; 35858var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RelationalPattern, operatorToken, expression, out hash); 35861var result = new RelationalPatternSyntax(SyntaxKind.RelationalPattern, operatorToken, expression); 35877var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypePattern, type, out hash); 35880var result = new TypePatternSyntax(SyntaxKind.TypePattern, type); 35889public static BinaryPatternSyntax BinaryPattern(SyntaxKind kind, PatternSyntax left, SyntaxToken operatorToken, PatternSyntax right) 35893case SyntaxKind.OrPattern: 35894case SyntaxKind.AndPattern: break; 35902case SyntaxKind.OrKeyword: 35903case SyntaxKind.AndKeyword: break; 35926if (operatorToken.Kind != SyntaxKind.NotKeyword) throw new ArgumentException(nameof(operatorToken)); 35931var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NotPattern, operatorToken, pattern, out hash); 35934var result = new UnaryPatternSyntax(SyntaxKind.NotPattern, operatorToken, pattern); 35947if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 35949if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 35952return new ListPatternSyntax(SyntaxKind.ListPattern, openBracketToken, patterns.Node, closeBracketToken, designation); 35959if (dotDotToken.Kind != SyntaxKind.DotDotToken) throw new ArgumentException(nameof(dotDotToken)); 35963var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SlicePattern, dotDotToken, pattern, out hash); 35966var result = new SlicePatternSyntax(SyntaxKind.SlicePattern, dotDotToken, pattern); 35979if (textToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(textToken)); 35983var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolatedStringText, textToken, out hash); 35986var result = new InterpolatedStringTextSyntax(SyntaxKind.InterpolatedStringText, textToken); 35999if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 36002if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 36005return new InterpolationSyntax(SyntaxKind.Interpolation, openBraceToken, expression, alignmentClause, formatClause, closeBraceToken); 36016var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationAlignmentClause, commaToken, value, out hash); 36019var result = new InterpolationAlignmentClauseSyntax(SyntaxKind.InterpolationAlignmentClause, commaToken, value); 36033if (formatStringToken.Kind != SyntaxKind.InterpolatedStringTextToken) throw new ArgumentException(nameof(formatStringToken)); 36037var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken, out hash); 36040var result = new InterpolationFormatClauseSyntax(SyntaxKind.InterpolationFormatClause, colonToken, formatStringToken); 36056var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement, out hash); 36059var result = new GlobalStatementSyntax(SyntaxKind.GlobalStatement, attributeLists.Node, modifiers.Node, statement); 36072if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 36074if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 36077return new BlockSyntax(SyntaxKind.Block, attributeLists.Node, openBraceToken, statements.Node, closeBraceToken); 36085if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36091case SyntaxKind.SemicolonToken: 36092case SyntaxKind.None: break; 36098return new LocalFunctionStatementSyntax(SyntaxKind.LocalFunctionStatement, attributeLists.Node, modifiers.Node, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); 36108case SyntaxKind.AwaitKeyword: 36109case SyntaxKind.None: break; 36117case SyntaxKind.UsingKeyword: 36118case SyntaxKind.None: break; 36124if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36127return new LocalDeclarationStatementSyntax(SyntaxKind.LocalDeclarationStatement, attributeLists.Node, awaitKeyword, usingKeyword, modifiers.Node, declaration, semicolonToken); 36137var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclaration, type, variables.Node, out hash); 36140var result = new VariableDeclarationSyntax(SyntaxKind.VariableDeclaration, type, variables.Node); 36153if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36157var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.VariableDeclarator, identifier, argumentList, initializer, out hash); 36160var result = new VariableDeclaratorSyntax(SyntaxKind.VariableDeclarator, identifier, argumentList, initializer); 36173if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 36178var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EqualsValueClause, equalsToken, value, out hash); 36181var result = new EqualsValueClauseSyntax(SyntaxKind.EqualsValueClause, equalsToken, value); 36194if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36198var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SingleVariableDesignation, identifier, out hash); 36201var result = new SingleVariableDesignationSyntax(SyntaxKind.SingleVariableDesignation, identifier); 36214if (underscoreToken.Kind != SyntaxKind.UnderscoreToken) throw new ArgumentException(nameof(underscoreToken)); 36218var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DiscardDesignation, underscoreToken, out hash); 36221var result = new DiscardDesignationSyntax(SyntaxKind.DiscardDesignation, underscoreToken); 36234if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36236if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36240var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken, out hash); 36243var result = new ParenthesizedVariableDesignationSyntax(SyntaxKind.ParenthesizedVariableDesignation, openParenToken, variables.Node, closeParenToken); 36257if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36261var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken, out hash); 36264var result = new ExpressionStatementSyntax(SyntaxKind.ExpressionStatement, attributeLists.Node, expression, semicolonToken); 36277if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36281var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken, out hash); 36284var result = new EmptyStatementSyntax(SyntaxKind.EmptyStatement, attributeLists.Node, semicolonToken); 36297if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36299if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 36303return new LabeledStatementSyntax(SyntaxKind.LabeledStatement, attributeLists.Node, identifier, colonToken, statement); 36306public static GotoStatementSyntax GotoStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken gotoKeyword, SyntaxToken? caseOrDefaultKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 36310case SyntaxKind.GotoStatement: 36311case SyntaxKind.GotoCaseStatement: 36312case SyntaxKind.GotoDefaultStatement: break; 36317if (gotoKeyword.Kind != SyntaxKind.GotoKeyword) throw new ArgumentException(nameof(gotoKeyword)); 36322case SyntaxKind.CaseKeyword: 36323case SyntaxKind.DefaultKeyword: 36324case SyntaxKind.None: break; 36329if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36339if (breakKeyword.Kind != SyntaxKind.BreakKeyword) throw new ArgumentException(nameof(breakKeyword)); 36341if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36345var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken, out hash); 36348var result = new BreakStatementSyntax(SyntaxKind.BreakStatement, attributeLists.Node, breakKeyword, semicolonToken); 36361if (continueKeyword.Kind != SyntaxKind.ContinueKeyword) throw new ArgumentException(nameof(continueKeyword)); 36363if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36367var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken, out hash); 36370var result = new ContinueStatementSyntax(SyntaxKind.ContinueStatement, attributeLists.Node, continueKeyword, semicolonToken); 36383if (returnKeyword.Kind != SyntaxKind.ReturnKeyword) throw new ArgumentException(nameof(returnKeyword)); 36385if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36388return new ReturnStatementSyntax(SyntaxKind.ReturnStatement, attributeLists.Node, returnKeyword, expression, semicolonToken); 36395if (throwKeyword.Kind != SyntaxKind.ThrowKeyword) throw new ArgumentException(nameof(throwKeyword)); 36397if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36400return new ThrowStatementSyntax(SyntaxKind.ThrowStatement, attributeLists.Node, throwKeyword, expression, semicolonToken); 36403public static YieldStatementSyntax YieldStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax? expression, SyntaxToken semicolonToken) 36407case SyntaxKind.YieldReturnStatement: 36408case SyntaxKind.YieldBreakStatement: break; 36413if (yieldKeyword.Kind != SyntaxKind.YieldKeyword) throw new ArgumentException(nameof(yieldKeyword)); 36417case SyntaxKind.ReturnKeyword: 36418case SyntaxKind.BreakKeyword: break; 36422if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36432if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 36434if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36437if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36441return new WhileStatementSyntax(SyntaxKind.WhileStatement, attributeLists.Node, whileKeyword, openParenToken, condition, closeParenToken, statement); 36448if (doKeyword.Kind != SyntaxKind.DoKeyword) throw new ArgumentException(nameof(doKeyword)); 36451if (whileKeyword.Kind != SyntaxKind.WhileKeyword) throw new ArgumentException(nameof(whileKeyword)); 36453if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36456if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36458if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36461return new DoStatementSyntax(SyntaxKind.DoStatement, attributeLists.Node, doKeyword, statement, whileKeyword, openParenToken, condition, closeParenToken, semicolonToken); 36468if (forKeyword.Kind != SyntaxKind.ForKeyword) throw new ArgumentException(nameof(forKeyword)); 36470if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36472if (firstSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(firstSemicolonToken)); 36474if (secondSemicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(secondSemicolonToken)); 36476if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36480return new ForStatementSyntax(SyntaxKind.ForStatement, attributeLists.Node, forKeyword, openParenToken, declaration, initializers.Node, firstSemicolonToken, condition, secondSemicolonToken, incrementors.Node, closeParenToken, statement); 36490case SyntaxKind.AwaitKeyword: 36491case SyntaxKind.None: break; 36496if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 36498if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36501if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36503if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 36506if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36510return new ForEachStatementSyntax(SyntaxKind.ForEachStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, type, identifier, inKeyword, expression, closeParenToken, statement); 36520case SyntaxKind.AwaitKeyword: 36521case SyntaxKind.None: break; 36526if (forEachKeyword.Kind != SyntaxKind.ForEachKeyword) throw new ArgumentException(nameof(forEachKeyword)); 36528if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36531if (inKeyword.Kind != SyntaxKind.InKeyword) throw new ArgumentException(nameof(inKeyword)); 36534if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36538return new ForEachVariableStatementSyntax(SyntaxKind.ForEachVariableStatement, attributeLists.Node, awaitKeyword, forEachKeyword, openParenToken, variable, inKeyword, expression, closeParenToken, statement); 36548case SyntaxKind.AwaitKeyword: 36549case SyntaxKind.None: break; 36554if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 36556if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36558if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36562return new UsingStatementSyntax(SyntaxKind.UsingStatement, attributeLists.Node, awaitKeyword, usingKeyword, openParenToken, declaration, expression, closeParenToken, statement); 36569if (fixedKeyword.Kind != SyntaxKind.FixedKeyword) throw new ArgumentException(nameof(fixedKeyword)); 36571if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36574if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36578return new FixedStatementSyntax(SyntaxKind.FixedStatement, attributeLists.Node, fixedKeyword, openParenToken, declaration, closeParenToken, statement); 36581public static CheckedStatementSyntax CheckedStatement(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken keyword, BlockSyntax block) 36585case SyntaxKind.CheckedStatement: 36586case SyntaxKind.UncheckedStatement: break; 36593case SyntaxKind.CheckedKeyword: 36594case SyntaxKind.UncheckedKeyword: break; 36617if (unsafeKeyword.Kind != SyntaxKind.UnsafeKeyword) throw new ArgumentException(nameof(unsafeKeyword)); 36622var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block, out hash); 36625var result = new UnsafeStatementSyntax(SyntaxKind.UnsafeStatement, attributeLists.Node, unsafeKeyword, block); 36638if (lockKeyword.Kind != SyntaxKind.LockKeyword) throw new ArgumentException(nameof(lockKeyword)); 36640if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36643if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36647return new LockStatementSyntax(SyntaxKind.LockStatement, attributeLists.Node, lockKeyword, openParenToken, expression, closeParenToken, statement); 36654if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 36656if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36659if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36663return new IfStatementSyntax(SyntaxKind.IfStatement, attributeLists.Node, ifKeyword, openParenToken, condition, closeParenToken, statement, @else); 36670if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 36675var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ElseClause, elseKeyword, statement, out hash); 36678var result = new ElseClauseSyntax(SyntaxKind.ElseClause, elseKeyword, statement); 36691if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 36696case SyntaxKind.OpenParenToken: 36697case SyntaxKind.None: break; 36706case SyntaxKind.CloseParenToken: 36707case SyntaxKind.None: break; 36712if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 36714if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 36717return new SwitchStatementSyntax(SyntaxKind.SwitchStatement, attributeLists.Node, switchKeyword, openParenToken, expression, closeParenToken, openBraceToken, sections.Node, closeBraceToken); 36726var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SwitchSection, labels.Node, statements.Node, out hash); 36729var result = new SwitchSectionSyntax(SyntaxKind.SwitchSection, labels.Node, statements.Node); 36742if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 36747return new CasePatternSwitchLabelSyntax(SyntaxKind.CasePatternSwitchLabel, keyword, pattern, whenClause, colonToken); 36754if (keyword.Kind != SyntaxKind.CaseKeyword) throw new ArgumentException(nameof(keyword)); 36760var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CaseSwitchLabel, keyword, value, colonToken, out hash); 36763var result = new CaseSwitchLabelSyntax(SyntaxKind.CaseSwitchLabel, keyword, value, colonToken); 36776if (keyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(keyword)); 36781var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultSwitchLabel, keyword, colonToken, out hash); 36784var result = new DefaultSwitchLabelSyntax(SyntaxKind.DefaultSwitchLabel, keyword, colonToken); 36798if (switchKeyword.Kind != SyntaxKind.SwitchKeyword) throw new ArgumentException(nameof(switchKeyword)); 36800if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 36802if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 36805return new SwitchExpressionSyntax(SyntaxKind.SwitchExpression, governingExpression, switchKeyword, openBraceToken, arms.Node, closeBraceToken); 36813if (equalsGreaterThanToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(equalsGreaterThanToken)); 36817return new SwitchExpressionArmSyntax(SyntaxKind.SwitchExpressionArm, pattern, whenClause, equalsGreaterThanToken, expression); 36824if (tryKeyword.Kind != SyntaxKind.TryKeyword) throw new ArgumentException(nameof(tryKeyword)); 36828return new TryStatementSyntax(SyntaxKind.TryStatement, attributeLists.Node, tryKeyword, block, catches.Node, @finally); 36835if (catchKeyword.Kind != SyntaxKind.CatchKeyword) throw new ArgumentException(nameof(catchKeyword)); 36839return new CatchClauseSyntax(SyntaxKind.CatchClause, catchKeyword, declaration, filter, block); 36846if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36852case SyntaxKind.IdentifierToken: 36853case SyntaxKind.None: break; 36858if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36861return new CatchDeclarationSyntax(SyntaxKind.CatchDeclaration, openParenToken, type, identifier, closeParenToken); 36868if (whenKeyword.Kind != SyntaxKind.WhenKeyword) throw new ArgumentException(nameof(whenKeyword)); 36870if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 36873if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 36876return new CatchFilterClauseSyntax(SyntaxKind.CatchFilterClause, whenKeyword, openParenToken, filterExpression, closeParenToken); 36883if (finallyKeyword.Kind != SyntaxKind.FinallyKeyword) throw new ArgumentException(nameof(finallyKeyword)); 36888var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FinallyClause, finallyKeyword, block, out hash); 36891var result = new FinallyClauseSyntax(SyntaxKind.FinallyClause, finallyKeyword, block); 36904if (endOfFileToken.Kind != SyntaxKind.EndOfFileToken) throw new ArgumentException(nameof(endOfFileToken)); 36907return new CompilationUnitSyntax(SyntaxKind.CompilationUnit, externs.Node, usings.Node, attributeLists.Node, members.Node, endOfFileToken); 36914if (externKeyword.Kind != SyntaxKind.ExternKeyword) throw new ArgumentException(nameof(externKeyword)); 36916if (aliasKeyword.Kind != SyntaxKind.AliasKeyword) throw new ArgumentException(nameof(aliasKeyword)); 36918if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 36920if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36923return new ExternAliasDirectiveSyntax(SyntaxKind.ExternAliasDirective, externKeyword, aliasKeyword, identifier, semicolonToken); 36933case SyntaxKind.GlobalKeyword: 36934case SyntaxKind.None: break; 36939if (usingKeyword.Kind != SyntaxKind.UsingKeyword) throw new ArgumentException(nameof(usingKeyword)); 36944case SyntaxKind.StaticKeyword: 36945case SyntaxKind.None: break; 36953case SyntaxKind.UnsafeKeyword: 36954case SyntaxKind.None: break; 36960if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 36963return new UsingDirectiveSyntax(SyntaxKind.UsingDirective, globalKeyword, usingKeyword, staticKeyword, unsafeKeyword, alias, namespaceOrType, semicolonToken); 36970if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 36973if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 36975if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 36980case SyntaxKind.SemicolonToken: 36981case SyntaxKind.None: break; 36987return new NamespaceDeclarationSyntax(SyntaxKind.NamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, openBraceToken, externs.Node, usings.Node, members.Node, closeBraceToken, semicolonToken); 36994if (namespaceKeyword.Kind != SyntaxKind.NamespaceKeyword) throw new ArgumentException(nameof(namespaceKeyword)); 36997if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37000return new FileScopedNamespaceDeclarationSyntax(SyntaxKind.FileScopedNamespaceDeclaration, attributeLists.Node, modifiers.Node, namespaceKeyword, name, semicolonToken, externs.Node, usings.Node, members.Node); 37007if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 37009if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 37012return new AttributeListSyntax(SyntaxKind.AttributeList, openBracketToken, target, attributes.Node, closeBracketToken); 37020if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 37024var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeTargetSpecifier, identifier, colonToken, out hash); 37027var result = new AttributeTargetSpecifierSyntax(SyntaxKind.AttributeTargetSpecifier, identifier, colonToken); 37042return new AttributeSyntax(SyntaxKind.Attribute, name, argumentList); 37049if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37051if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37055var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken, out hash); 37058var result = new AttributeArgumentListSyntax(SyntaxKind.AttributeArgumentList, openParenToken, arguments.Node, closeParenToken); 37074var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AttributeArgument, nameEquals, nameColon, expression, out hash); 37077var result = new AttributeArgumentSyntax(SyntaxKind.AttributeArgument, nameEquals, nameColon, expression); 37091if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 37095var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameEquals, name, equalsToken, out hash); 37098var result = new NameEqualsSyntax(SyntaxKind.NameEquals, name, equalsToken); 37111if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 37113if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 37117var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken, out hash); 37120var result = new TypeParameterListSyntax(SyntaxKind.TypeParameterList, lessThanToken, parameters.Node, greaterThanToken); 37136case SyntaxKind.InKeyword: 37137case SyntaxKind.OutKeyword: 37138case SyntaxKind.None: break; 37143if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37147var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier, out hash); 37150var result = new TypeParameterSyntax(SyntaxKind.TypeParameter, attributeLists.Node, varianceKeyword, identifier); 37163if (keyword.Kind != SyntaxKind.ClassKeyword) throw new ArgumentException(nameof(keyword)); 37165if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37170case SyntaxKind.OpenBraceToken: 37171case SyntaxKind.None: break; 37179case SyntaxKind.CloseBraceToken: 37180case SyntaxKind.None: break; 37188case SyntaxKind.SemicolonToken: 37189case SyntaxKind.None: break; 37195return new ClassDeclarationSyntax(SyntaxKind.ClassDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37198public static StructDeclarationSyntax StructDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, CoreSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax? parameterList, BaseListSyntax? baseList, CoreSyntax.SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, SyntaxToken? openBraceToken, CoreSyntax.SyntaxList<MemberDeclarationSyntax> members, SyntaxToken? closeBraceToken, SyntaxToken? semicolonToken) 37202case SyntaxKind.StructDeclaration: 37203case SyntaxKind.UnionDeclaration: break; 37210case SyntaxKind.StructKeyword: 37211case SyntaxKind.UnionKeyword: break; 37215if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37220case SyntaxKind.OpenBraceToken: 37221case SyntaxKind.None: break; 37229case SyntaxKind.CloseBraceToken: 37230case SyntaxKind.None: break; 37238case SyntaxKind.SemicolonToken: 37239case SyntaxKind.None: break; 37252if (keyword.Kind != SyntaxKind.InterfaceKeyword) throw new ArgumentException(nameof(keyword)); 37254if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37259case SyntaxKind.OpenBraceToken: 37260case SyntaxKind.None: break; 37268case SyntaxKind.CloseBraceToken: 37269case SyntaxKind.None: break; 37277case SyntaxKind.SemicolonToken: 37278case SyntaxKind.None: break; 37284return new InterfaceDeclarationSyntax(SyntaxKind.InterfaceDeclaration, attributeLists.Node, modifiers.Node, keyword, identifier, typeParameterList, parameterList, baseList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37287public 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) 37291case SyntaxKind.RecordDeclaration: 37292case SyntaxKind.RecordStructDeclaration: break; 37301case SyntaxKind.ClassKeyword: 37302case SyntaxKind.StructKeyword: 37303case SyntaxKind.None: break; 37308if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37313case SyntaxKind.OpenBraceToken: 37314case SyntaxKind.None: break; 37322case SyntaxKind.CloseBraceToken: 37323case SyntaxKind.None: break; 37331case SyntaxKind.SemicolonToken: 37332case SyntaxKind.None: break; 37345if (enumKeyword.Kind != SyntaxKind.EnumKeyword) throw new ArgumentException(nameof(enumKeyword)); 37347if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37352case SyntaxKind.OpenBraceToken: 37353case SyntaxKind.None: break; 37361case SyntaxKind.CloseBraceToken: 37362case SyntaxKind.None: break; 37370case SyntaxKind.SemicolonToken: 37371case SyntaxKind.None: break; 37377return new EnumDeclarationSyntax(SyntaxKind.EnumDeclaration, attributeLists.Node, modifiers.Node, enumKeyword, identifier, baseList, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37384if (delegateKeyword.Kind != SyntaxKind.DelegateKeyword) throw new ArgumentException(nameof(delegateKeyword)); 37387if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37390if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37393return new DelegateDeclarationSyntax(SyntaxKind.DelegateDeclaration, attributeLists.Node, modifiers.Node, delegateKeyword, returnType, identifier, typeParameterList, parameterList, constraintClauses.Node, semicolonToken); 37400if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37403return new EnumMemberDeclarationSyntax(SyntaxKind.EnumMemberDeclaration, attributeLists.Node, modifiers.Node, identifier, equalsValue); 37410if (keyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(keyword)); 37415case SyntaxKind.OpenBraceToken: 37416case SyntaxKind.None: break; 37424case SyntaxKind.CloseBraceToken: 37425case SyntaxKind.None: break; 37433case SyntaxKind.SemicolonToken: 37434case SyntaxKind.None: break; 37440return new ExtensionBlockDeclarationSyntax(SyntaxKind.ExtensionBlockDeclaration, attributeLists.Node, modifiers.Node, keyword, typeParameterList, parameterList, constraintClauses.Node, openBraceToken, members.Node, closeBraceToken, semicolonToken); 37447if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 37451var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BaseList, colonToken, types.Node, out hash); 37454var result = new BaseListSyntax(SyntaxKind.BaseList, colonToken, types.Node); 37470var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.SimpleBaseType, type, out hash); 37473var result = new SimpleBaseTypeSyntax(SyntaxKind.SimpleBaseType, type); 37490var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.PrimaryConstructorBaseType, type, argumentList, out hash); 37493var result = new PrimaryConstructorBaseTypeSyntax(SyntaxKind.PrimaryConstructorBaseType, type, argumentList); 37506if (whereKeyword.Kind != SyntaxKind.WhereKeyword) throw new ArgumentException(nameof(whereKeyword)); 37509if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 37512return new TypeParameterConstraintClauseSyntax(SyntaxKind.TypeParameterConstraintClause, whereKeyword, name, colonToken, constraints.Node); 37519if (newKeyword.Kind != SyntaxKind.NewKeyword) throw new ArgumentException(nameof(newKeyword)); 37521if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 37523if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 37527var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken, out hash); 37530var result = new ConstructorConstraintSyntax(SyntaxKind.ConstructorConstraint, newKeyword, openParenToken, closeParenToken); 37539public static ClassOrStructConstraintSyntax ClassOrStructConstraint(SyntaxKind kind, SyntaxToken classOrStructKeyword, SyntaxToken? questionToken) 37543case SyntaxKind.ClassConstraint: 37544case SyntaxKind.StructConstraint: break; 37551case SyntaxKind.ClassKeyword: 37552case SyntaxKind.StructKeyword: break; 37559case SyntaxKind.QuestionToken: 37560case SyntaxKind.None: break; 37586var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeConstraint, type, out hash); 37589var result = new TypeConstraintSyntax(SyntaxKind.TypeConstraint, type); 37602if (defaultKeyword.Kind != SyntaxKind.DefaultKeyword) throw new ArgumentException(nameof(defaultKeyword)); 37606var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.DefaultConstraint, defaultKeyword, out hash); 37609var result = new DefaultConstraintSyntax(SyntaxKind.DefaultConstraint, defaultKeyword); 37622if (allowsKeyword.Kind != SyntaxKind.AllowsKeyword) throw new ArgumentException(nameof(allowsKeyword)); 37626var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node, out hash); 37629var result = new AllowsConstraintClauseSyntax(SyntaxKind.AllowsConstraintClause, allowsKeyword, constraints.Node); 37642if (refKeyword.Kind != SyntaxKind.RefKeyword) throw new ArgumentException(nameof(refKeyword)); 37644if (structKeyword.Kind != SyntaxKind.StructKeyword) throw new ArgumentException(nameof(structKeyword)); 37648var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.RefStructConstraint, refKeyword, structKeyword, out hash); 37651var result = new RefStructConstraintSyntax(SyntaxKind.RefStructConstraint, refKeyword, structKeyword); 37665if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37668return new FieldDeclarationSyntax(SyntaxKind.FieldDeclaration, attributeLists.Node, modifiers.Node, declaration, semicolonToken); 37675if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 37678if (semicolonToken.Kind != SyntaxKind.SemicolonToken) throw new ArgumentException(nameof(semicolonToken)); 37681return new EventFieldDeclarationSyntax(SyntaxKind.EventFieldDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, declaration, semicolonToken); 37689if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 37693var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken, out hash); 37696var result = new ExplicitInterfaceSpecifierSyntax(SyntaxKind.ExplicitInterfaceSpecifier, name, dotToken); 37710if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37716case SyntaxKind.SemicolonToken: 37717case SyntaxKind.None: break; 37723return new MethodDeclarationSyntax(SyntaxKind.MethodDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses.Node, body, expressionBody, semicolonToken); 37731if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 37736case SyntaxKind.CheckedKeyword: 37737case SyntaxKind.None: break; 37744case SyntaxKind.PlusToken: 37745case SyntaxKind.MinusToken: 37746case SyntaxKind.ExclamationToken: 37747case SyntaxKind.TildeToken: 37748case SyntaxKind.PlusPlusToken: 37749case SyntaxKind.MinusMinusToken: 37750case SyntaxKind.AsteriskToken: 37751case SyntaxKind.SlashToken: 37752case SyntaxKind.PercentToken: 37753case SyntaxKind.LessThanLessThanToken: 37754case SyntaxKind.GreaterThanGreaterThanToken: 37755case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 37756case SyntaxKind.BarToken: 37757case SyntaxKind.AmpersandToken: 37758case SyntaxKind.CaretToken: 37759case SyntaxKind.EqualsEqualsToken: 37760case SyntaxKind.ExclamationEqualsToken: 37761case SyntaxKind.LessThanToken: 37762case SyntaxKind.LessThanEqualsToken: 37763case SyntaxKind.GreaterThanToken: 37764case SyntaxKind.GreaterThanEqualsToken: 37765case SyntaxKind.FalseKeyword: 37766case SyntaxKind.TrueKeyword: 37767case SyntaxKind.IsKeyword: 37768case SyntaxKind.PlusEqualsToken: 37769case SyntaxKind.MinusEqualsToken: 37770case SyntaxKind.AsteriskEqualsToken: 37771case SyntaxKind.SlashEqualsToken: 37772case SyntaxKind.PercentEqualsToken: 37773case SyntaxKind.AmpersandEqualsToken: 37774case SyntaxKind.BarEqualsToken: 37775case SyntaxKind.CaretEqualsToken: 37776case SyntaxKind.LessThanLessThanEqualsToken: 37777case SyntaxKind.GreaterThanGreaterThanEqualsToken: 37778case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 37786case SyntaxKind.SemicolonToken: 37787case SyntaxKind.None: break; 37793return new OperatorDeclarationSyntax(SyntaxKind.OperatorDeclaration, attributeLists.Node, modifiers.Node, returnType, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, operatorToken, parameterList, body, expressionBody, semicolonToken); 37802case SyntaxKind.ImplicitKeyword: 37803case SyntaxKind.ExplicitKeyword: break; 37807if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 37812case SyntaxKind.CheckedKeyword: 37813case SyntaxKind.None: break; 37823case SyntaxKind.SemicolonToken: 37824case SyntaxKind.None: break; 37830return new ConversionOperatorDeclarationSyntax(SyntaxKind.ConversionOperatorDeclaration, attributeLists.Node, modifiers.Node, implicitOrExplicitKeyword, explicitInterfaceSpecifier, operatorKeyword, checkedKeyword, type, parameterList, body, expressionBody, semicolonToken); 37837if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37843case SyntaxKind.SemicolonToken: 37844case SyntaxKind.None: break; 37850return new ConstructorDeclarationSyntax(SyntaxKind.ConstructorDeclaration, attributeLists.Node, modifiers.Node, identifier, parameterList, initializer, body, expressionBody, semicolonToken); 37853public static ConstructorInitializerSyntax ConstructorInitializer(SyntaxKind kind, SyntaxToken colonToken, SyntaxToken thisOrBaseKeyword, ArgumentListSyntax argumentList) 37857case SyntaxKind.BaseConstructorInitializer: 37858case SyntaxKind.ThisConstructorInitializer: break; 37863if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 37867case SyntaxKind.BaseKeyword: 37868case SyntaxKind.ThisKeyword: break; 37891if (tildeToken.Kind != SyntaxKind.TildeToken) throw new ArgumentException(nameof(tildeToken)); 37893if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37899case SyntaxKind.SemicolonToken: 37900case SyntaxKind.None: break; 37906return new DestructorDeclarationSyntax(SyntaxKind.DestructorDeclaration, attributeLists.Node, modifiers.Node, tildeToken, identifier, parameterList, body, expressionBody, semicolonToken); 37914if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37919case SyntaxKind.SemicolonToken: 37920case SyntaxKind.None: break; 37926return new PropertyDeclarationSyntax(SyntaxKind.PropertyDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, identifier, accessorList, expressionBody, initializer, semicolonToken); 37933if (arrowToken.Kind != SyntaxKind.EqualsGreaterThanToken) throw new ArgumentException(nameof(arrowToken)); 37938var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ArrowExpressionClause, arrowToken, expression, out hash); 37941var result = new ArrowExpressionClauseSyntax(SyntaxKind.ArrowExpressionClause, arrowToken, expression); 37954if (eventKeyword.Kind != SyntaxKind.EventKeyword) throw new ArgumentException(nameof(eventKeyword)); 37957if (identifier.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(identifier)); 37962case SyntaxKind.SemicolonToken: 37963case SyntaxKind.None: break; 37969return new EventDeclarationSyntax(SyntaxKind.EventDeclaration, attributeLists.Node, modifiers.Node, eventKeyword, type, explicitInterfaceSpecifier, identifier, accessorList, semicolonToken); 37977if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 37983case SyntaxKind.SemicolonToken: 37984case SyntaxKind.None: break; 37990return new IndexerDeclarationSyntax(SyntaxKind.IndexerDeclaration, attributeLists.Node, modifiers.Node, type, explicitInterfaceSpecifier, thisKeyword, parameterList, accessorList, expressionBody, semicolonToken); 37997if (openBraceToken.Kind != SyntaxKind.OpenBraceToken) throw new ArgumentException(nameof(openBraceToken)); 37999if (closeBraceToken.Kind != SyntaxKind.CloseBraceToken) throw new ArgumentException(nameof(closeBraceToken)); 38003var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken, out hash); 38006var result = new AccessorListSyntax(SyntaxKind.AccessorList, openBraceToken, accessors.Node, closeBraceToken); 38015public static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, CoreSyntax.SyntaxList<AttributeListSyntax> attributeLists, CoreSyntax.SyntaxList<SyntaxToken> modifiers, SyntaxToken keyword, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken? semicolonToken) 38019case SyntaxKind.GetAccessorDeclaration: 38020case SyntaxKind.SetAccessorDeclaration: 38021case SyntaxKind.InitAccessorDeclaration: 38022case SyntaxKind.AddAccessorDeclaration: 38023case SyntaxKind.RemoveAccessorDeclaration: 38024case SyntaxKind.UnknownAccessorDeclaration: break; 38031case SyntaxKind.GetKeyword: 38032case SyntaxKind.SetKeyword: 38033case SyntaxKind.InitKeyword: 38034case SyntaxKind.AddKeyword: 38035case SyntaxKind.RemoveKeyword: 38036case SyntaxKind.IdentifierToken: break; 38043case SyntaxKind.SemicolonToken: 38044case SyntaxKind.None: break; 38057if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 38059if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 38063var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken, out hash); 38066var result = new ParameterListSyntax(SyntaxKind.ParameterList, openParenToken, parameters.Node, closeParenToken); 38079if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 38081if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 38085var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); 38088var result = new BracketedParameterListSyntax(SyntaxKind.BracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); 38104case SyntaxKind.IdentifierToken: 38105case SyntaxKind.ArgListKeyword: 38106case SyntaxKind.None: break; 38112return new ParameterSyntax(SyntaxKind.Parameter, attributeLists.Node, modifiers.Node, type, identifier, @default); 38122var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type, out hash); 38125var result = new FunctionPointerParameterSyntax(SyntaxKind.FunctionPointerParameter, attributeLists.Node, modifiers.Node, type); 38139return new IncompleteMemberSyntax(SyntaxKind.IncompleteMember, attributeLists.Node, modifiers.Node, type); 38147return new SkippedTokensTriviaSyntax(SyntaxKind.SkippedTokensTrivia, tokens.Node); 38150public static DocumentationCommentTriviaSyntax DocumentationCommentTrivia(SyntaxKind kind, CoreSyntax.SyntaxList<XmlNodeSyntax> content, SyntaxToken endOfComment) 38154case SyntaxKind.SingleLineDocumentationCommentTrivia: 38155case SyntaxKind.MultiLineDocumentationCommentTrivia: break; 38160if (endOfComment.Kind != SyntaxKind.EndOfDocumentationCommentToken) throw new ArgumentException(nameof(endOfComment)); 38173var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.TypeCref, type, out hash); 38176var result = new TypeCrefSyntax(SyntaxKind.TypeCref, type); 38190if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 38195var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.QualifiedCref, container, dotToken, member, out hash); 38198var result = new QualifiedCrefSyntax(SyntaxKind.QualifiedCref, container, dotToken, member); 38214var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.NameMemberCref, name, parameters, out hash); 38217var result = new NameMemberCrefSyntax(SyntaxKind.NameMemberCref, name, parameters); 38230if (extensionKeyword.Kind != SyntaxKind.ExtensionKeyword) throw new ArgumentException(nameof(extensionKeyword)); 38233if (dotToken.Kind != SyntaxKind.DotToken) throw new ArgumentException(nameof(dotToken)); 38237return new ExtensionMemberCrefSyntax(SyntaxKind.ExtensionMemberCref, extensionKeyword, typeArgumentList, parameters, dotToken, member); 38244if (thisKeyword.Kind != SyntaxKind.ThisKeyword) throw new ArgumentException(nameof(thisKeyword)); 38248var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.IndexerMemberCref, thisKeyword, parameters, out hash); 38251var result = new IndexerMemberCrefSyntax(SyntaxKind.IndexerMemberCref, thisKeyword, parameters); 38264if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 38269case SyntaxKind.CheckedKeyword: 38270case SyntaxKind.None: break; 38277case SyntaxKind.PlusToken: 38278case SyntaxKind.MinusToken: 38279case SyntaxKind.ExclamationToken: 38280case SyntaxKind.TildeToken: 38281case SyntaxKind.PlusPlusToken: 38282case SyntaxKind.MinusMinusToken: 38283case SyntaxKind.AsteriskToken: 38284case SyntaxKind.SlashToken: 38285case SyntaxKind.PercentToken: 38286case SyntaxKind.LessThanLessThanToken: 38287case SyntaxKind.GreaterThanGreaterThanToken: 38288case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 38289case SyntaxKind.BarToken: 38290case SyntaxKind.AmpersandToken: 38291case SyntaxKind.CaretToken: 38292case SyntaxKind.EqualsEqualsToken: 38293case SyntaxKind.ExclamationEqualsToken: 38294case SyntaxKind.LessThanToken: 38295case SyntaxKind.LessThanEqualsToken: 38296case SyntaxKind.GreaterThanToken: 38297case SyntaxKind.GreaterThanEqualsToken: 38298case SyntaxKind.FalseKeyword: 38299case SyntaxKind.TrueKeyword: 38300case SyntaxKind.PlusEqualsToken: 38301case SyntaxKind.MinusEqualsToken: 38302case SyntaxKind.AsteriskEqualsToken: 38303case SyntaxKind.SlashEqualsToken: 38304case SyntaxKind.PercentEqualsToken: 38305case SyntaxKind.AmpersandEqualsToken: 38306case SyntaxKind.BarEqualsToken: 38307case SyntaxKind.CaretEqualsToken: 38308case SyntaxKind.LessThanLessThanEqualsToken: 38309case SyntaxKind.GreaterThanGreaterThanEqualsToken: 38310case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: break; 38315return new OperatorMemberCrefSyntax(SyntaxKind.OperatorMemberCref, operatorKeyword, checkedKeyword, operatorToken, parameters); 38324case SyntaxKind.ImplicitKeyword: 38325case SyntaxKind.ExplicitKeyword: break; 38329if (operatorKeyword.Kind != SyntaxKind.OperatorKeyword) throw new ArgumentException(nameof(operatorKeyword)); 38334case SyntaxKind.CheckedKeyword: 38335case SyntaxKind.None: break; 38342return new ConversionOperatorMemberCrefSyntax(SyntaxKind.ConversionOperatorMemberCref, implicitOrExplicitKeyword, operatorKeyword, checkedKeyword, type, parameters); 38349if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 38351if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 38355var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken, out hash); 38358var result = new CrefParameterListSyntax(SyntaxKind.CrefParameterList, openParenToken, parameters.Node, closeParenToken); 38371if (openBracketToken.Kind != SyntaxKind.OpenBracketToken) throw new ArgumentException(nameof(openBracketToken)); 38373if (closeBracketToken.Kind != SyntaxKind.CloseBracketToken) throw new ArgumentException(nameof(closeBracketToken)); 38377var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken, out hash); 38380var result = new CrefBracketedParameterListSyntax(SyntaxKind.CrefBracketedParameterList, openBracketToken, parameters.Node, closeBracketToken); 38396case SyntaxKind.RefKeyword: 38397case SyntaxKind.OutKeyword: 38398case SyntaxKind.InKeyword: 38399case SyntaxKind.None: break; 38407case SyntaxKind.ReadOnlyKeyword: 38408case SyntaxKind.None: break; 38416var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type, out hash); 38419var result = new CrefParameterSyntax(SyntaxKind.CrefParameter, refKindKeyword, readOnlyKeyword, type); 38436var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElement, startTag, content.Node, endTag, out hash); 38439var result = new XmlElementSyntax(SyntaxKind.XmlElement, startTag, content.Node, endTag); 38452if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 38455if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 38458return new XmlElementStartTagSyntax(SyntaxKind.XmlElementStartTag, lessThanToken, name, attributes.Node, greaterThanToken); 38465if (lessThanSlashToken.Kind != SyntaxKind.LessThanSlashToken) throw new ArgumentException(nameof(lessThanSlashToken)); 38468if (greaterThanToken.Kind != SyntaxKind.GreaterThanToken) throw new ArgumentException(nameof(greaterThanToken)); 38472var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken, out hash); 38475var result = new XmlElementEndTagSyntax(SyntaxKind.XmlElementEndTag, lessThanSlashToken, name, greaterThanToken); 38488if (lessThanToken.Kind != SyntaxKind.LessThanToken) throw new ArgumentException(nameof(lessThanToken)); 38491if (slashGreaterThanToken.Kind != SyntaxKind.SlashGreaterThanToken) throw new ArgumentException(nameof(slashGreaterThanToken)); 38494return new XmlEmptyElementSyntax(SyntaxKind.XmlEmptyElement, lessThanToken, name, attributes.Node, slashGreaterThanToken); 38501if (localName.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(localName)); 38505var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlName, prefix, localName, out hash); 38508var result = new XmlNameSyntax(SyntaxKind.XmlName, prefix, localName); 38521if (prefix.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(prefix)); 38523if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 38527var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlPrefix, prefix, colonToken, out hash); 38530var result = new XmlPrefixSyntax(SyntaxKind.XmlPrefix, prefix, colonToken); 38544if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 38548case SyntaxKind.SingleQuoteToken: 38549case SyntaxKind.DoubleQuoteToken: break; 38555case SyntaxKind.SingleQuoteToken: 38556case SyntaxKind.DoubleQuoteToken: break; 38561return new XmlTextAttributeSyntax(SyntaxKind.XmlTextAttribute, name, equalsToken, startQuoteToken, textTokens.Node, endQuoteToken); 38569if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 38573case SyntaxKind.SingleQuoteToken: 38574case SyntaxKind.DoubleQuoteToken: break; 38581case SyntaxKind.SingleQuoteToken: 38582case SyntaxKind.DoubleQuoteToken: break; 38587return new XmlCrefAttributeSyntax(SyntaxKind.XmlCrefAttribute, name, equalsToken, startQuoteToken, cref, endQuoteToken); 38595if (equalsToken.Kind != SyntaxKind.EqualsToken) throw new ArgumentException(nameof(equalsToken)); 38599case SyntaxKind.SingleQuoteToken: 38600case SyntaxKind.DoubleQuoteToken: break; 38607case SyntaxKind.SingleQuoteToken: 38608case SyntaxKind.DoubleQuoteToken: break; 38613return new XmlNameAttributeSyntax(SyntaxKind.XmlNameAttribute, name, equalsToken, startQuoteToken, identifier, endQuoteToken); 38622var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlText, textTokens.Node, out hash); 38625var result = new XmlTextSyntax(SyntaxKind.XmlText, textTokens.Node); 38638if (startCDataToken.Kind != SyntaxKind.XmlCDataStartToken) throw new ArgumentException(nameof(startCDataToken)); 38640if (endCDataToken.Kind != SyntaxKind.XmlCDataEndToken) throw new ArgumentException(nameof(endCDataToken)); 38644var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken, out hash); 38647var result = new XmlCDataSectionSyntax(SyntaxKind.XmlCDataSection, startCDataToken, textTokens.Node, endCDataToken); 38660if (startProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionStartToken) throw new ArgumentException(nameof(startProcessingInstructionToken)); 38663if (endProcessingInstructionToken.Kind != SyntaxKind.XmlProcessingInstructionEndToken) throw new ArgumentException(nameof(endProcessingInstructionToken)); 38666return new XmlProcessingInstructionSyntax(SyntaxKind.XmlProcessingInstruction, startProcessingInstructionToken, name, textTokens.Node, endProcessingInstructionToken); 38673if (lessThanExclamationMinusMinusToken.Kind != SyntaxKind.XmlCommentStartToken) throw new ArgumentException(nameof(lessThanExclamationMinusMinusToken)); 38675if (minusMinusGreaterThanToken.Kind != SyntaxKind.XmlCommentEndToken) throw new ArgumentException(nameof(minusMinusGreaterThanToken)); 38679var cached = SyntaxNodeCache.TryGetNode((int)SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken, out hash); 38682var result = new XmlCommentSyntax(SyntaxKind.XmlComment, lessThanExclamationMinusMinusToken, textTokens.Node, minusMinusGreaterThanToken); 38695if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38697if (ifKeyword.Kind != SyntaxKind.IfKeyword) throw new ArgumentException(nameof(ifKeyword)); 38700if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38703return new IfDirectiveTriviaSyntax(SyntaxKind.IfDirectiveTrivia, hashToken, ifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); 38710if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38712if (elifKeyword.Kind != SyntaxKind.ElifKeyword) throw new ArgumentException(nameof(elifKeyword)); 38715if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38718return new ElifDirectiveTriviaSyntax(SyntaxKind.ElifDirectiveTrivia, hashToken, elifKeyword, condition, endOfDirectiveToken, isActive, branchTaken, conditionValue); 38725if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38727if (elseKeyword.Kind != SyntaxKind.ElseKeyword) throw new ArgumentException(nameof(elseKeyword)); 38729if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38732return new ElseDirectiveTriviaSyntax(SyntaxKind.ElseDirectiveTrivia, hashToken, elseKeyword, endOfDirectiveToken, isActive, branchTaken); 38739if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38741if (endIfKeyword.Kind != SyntaxKind.EndIfKeyword) throw new ArgumentException(nameof(endIfKeyword)); 38743if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38746return new EndIfDirectiveTriviaSyntax(SyntaxKind.EndIfDirectiveTrivia, hashToken, endIfKeyword, endOfDirectiveToken, isActive); 38753if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38755if (regionKeyword.Kind != SyntaxKind.RegionKeyword) throw new ArgumentException(nameof(regionKeyword)); 38757if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38760return new RegionDirectiveTriviaSyntax(SyntaxKind.RegionDirectiveTrivia, hashToken, regionKeyword, endOfDirectiveToken, isActive); 38767if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38769if (endRegionKeyword.Kind != SyntaxKind.EndRegionKeyword) throw new ArgumentException(nameof(endRegionKeyword)); 38771if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38774return new EndRegionDirectiveTriviaSyntax(SyntaxKind.EndRegionDirectiveTrivia, hashToken, endRegionKeyword, endOfDirectiveToken, isActive); 38781if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38783if (errorKeyword.Kind != SyntaxKind.ErrorKeyword) throw new ArgumentException(nameof(errorKeyword)); 38785if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38788return new ErrorDirectiveTriviaSyntax(SyntaxKind.ErrorDirectiveTrivia, hashToken, errorKeyword, endOfDirectiveToken, isActive); 38795if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38797if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 38799if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38802return new WarningDirectiveTriviaSyntax(SyntaxKind.WarningDirectiveTrivia, hashToken, warningKeyword, endOfDirectiveToken, isActive); 38809if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38812if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38815return new BadDirectiveTriviaSyntax(SyntaxKind.BadDirectiveTrivia, hashToken, identifier, endOfDirectiveToken, isActive); 38822if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38824if (defineKeyword.Kind != SyntaxKind.DefineKeyword) throw new ArgumentException(nameof(defineKeyword)); 38826if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 38828if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38831return new DefineDirectiveTriviaSyntax(SyntaxKind.DefineDirectiveTrivia, hashToken, defineKeyword, name, endOfDirectiveToken, isActive); 38838if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38840if (undefKeyword.Kind != SyntaxKind.UndefKeyword) throw new ArgumentException(nameof(undefKeyword)); 38842if (name.Kind != SyntaxKind.IdentifierToken) throw new ArgumentException(nameof(name)); 38844if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38847return new UndefDirectiveTriviaSyntax(SyntaxKind.UndefDirectiveTrivia, hashToken, undefKeyword, name, endOfDirectiveToken, isActive); 38854if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38856if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 38860case SyntaxKind.NumericLiteralToken: 38861case SyntaxKind.DefaultKeyword: 38862case SyntaxKind.HiddenKeyword: break; 38869case SyntaxKind.StringLiteralToken: 38870case SyntaxKind.None: break; 38875if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38878return new LineDirectiveTriviaSyntax(SyntaxKind.LineDirectiveTrivia, hashToken, lineKeyword, line, file, endOfDirectiveToken, isActive); 38885if (openParenToken.Kind != SyntaxKind.OpenParenToken) throw new ArgumentException(nameof(openParenToken)); 38887if (line.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(line)); 38889if (commaToken.Kind != SyntaxKind.CommaToken) throw new ArgumentException(nameof(commaToken)); 38891if (character.Kind != SyntaxKind.NumericLiteralToken) throw new ArgumentException(nameof(character)); 38893if (closeParenToken.Kind != SyntaxKind.CloseParenToken) throw new ArgumentException(nameof(closeParenToken)); 38896return new LineDirectivePositionSyntax(SyntaxKind.LineDirectivePosition, openParenToken, line, commaToken, character, closeParenToken); 38903if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38905if (lineKeyword.Kind != SyntaxKind.LineKeyword) throw new ArgumentException(nameof(lineKeyword)); 38908if (minusToken.Kind != SyntaxKind.MinusToken) throw new ArgumentException(nameof(minusToken)); 38914case SyntaxKind.NumericLiteralToken: 38915case SyntaxKind.None: break; 38920if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 38922if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38925return new LineSpanDirectiveTriviaSyntax(SyntaxKind.LineSpanDirectiveTrivia, hashToken, lineKeyword, start, minusToken, end, characterOffset, file, endOfDirectiveToken, isActive); 38932if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38934if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 38936if (warningKeyword.Kind != SyntaxKind.WarningKeyword) throw new ArgumentException(nameof(warningKeyword)); 38940case SyntaxKind.DisableKeyword: 38941case SyntaxKind.RestoreKeyword: break; 38945if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38948return new PragmaWarningDirectiveTriviaSyntax(SyntaxKind.PragmaWarningDirectiveTrivia, hashToken, pragmaKeyword, warningKeyword, disableOrRestoreKeyword, errorCodes.Node, endOfDirectiveToken, isActive); 38955if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38957if (pragmaKeyword.Kind != SyntaxKind.PragmaKeyword) throw new ArgumentException(nameof(pragmaKeyword)); 38959if (checksumKeyword.Kind != SyntaxKind.ChecksumKeyword) throw new ArgumentException(nameof(checksumKeyword)); 38961if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 38963if (guid.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(guid)); 38965if (bytes.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(bytes)); 38967if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38970return new PragmaChecksumDirectiveTriviaSyntax(SyntaxKind.PragmaChecksumDirectiveTrivia, hashToken, pragmaKeyword, checksumKeyword, file, guid, bytes, endOfDirectiveToken, isActive); 38977if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38979if (referenceKeyword.Kind != SyntaxKind.ReferenceKeyword) throw new ArgumentException(nameof(referenceKeyword)); 38981if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 38983if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 38986return new ReferenceDirectiveTriviaSyntax(SyntaxKind.ReferenceDirectiveTrivia, hashToken, referenceKeyword, file, endOfDirectiveToken, isActive); 38993if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 38995if (loadKeyword.Kind != SyntaxKind.LoadKeyword) throw new ArgumentException(nameof(loadKeyword)); 38997if (file.Kind != SyntaxKind.StringLiteralToken) throw new ArgumentException(nameof(file)); 38999if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39002return new LoadDirectiveTriviaSyntax(SyntaxKind.LoadDirectiveTrivia, hashToken, loadKeyword, file, endOfDirectiveToken, isActive); 39009if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39011if (exclamationToken.Kind != SyntaxKind.ExclamationToken) throw new ArgumentException(nameof(exclamationToken)); 39013if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39016return new ShebangDirectiveTriviaSyntax(SyntaxKind.ShebangDirectiveTrivia, hashToken, exclamationToken, endOfDirectiveToken, isActive); 39023if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39025if (colonToken.Kind != SyntaxKind.ColonToken) throw new ArgumentException(nameof(colonToken)); 39030case SyntaxKind.StringLiteralToken: 39031case SyntaxKind.None: break; 39036if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39039return new IgnoredDirectiveTriviaSyntax(SyntaxKind.IgnoredDirectiveTrivia, hashToken, colonToken, content, endOfDirectiveToken, isActive); 39046if (hashToken.Kind != SyntaxKind.HashToken) throw new ArgumentException(nameof(hashToken)); 39048if (nullableKeyword.Kind != SyntaxKind.NullableKeyword) throw new ArgumentException(nameof(nullableKeyword)); 39052case SyntaxKind.EnableKeyword: 39053case SyntaxKind.DisableKeyword: 39054case SyntaxKind.RestoreKeyword: break; 39061case SyntaxKind.WarningsKeyword: 39062case SyntaxKind.AnnotationsKeyword: 39063case SyntaxKind.None: break; 39068if (endOfDirectiveToken.Kind != SyntaxKind.EndOfDirectiveToken) throw new ArgumentException(nameof(endOfDirectiveToken)); 39071return new NullableDirectiveTriviaSyntax(SyntaxKind.NullableDirectiveTrivia, hashToken, nullableKeyword, settingToken, targetToken, endOfDirectiveToken, isActive);
_generated\2\Syntax.xml.Syntax.Generated.cs (321)
41/// <item><description><see cref="SyntaxKind.IdentifierName"/></description></item> 82/// <item><description><see cref="SyntaxKind.QualifiedName"/></description></item> 144/// <item><description><see cref="SyntaxKind.GenericName"/></description></item> 192/// <item><description><see cref="SyntaxKind.TypeArgumentList"/></description></item> 250/// <item><description><see cref="SyntaxKind.AliasQualifiedName"/></description></item> 321/// <item><description><see cref="SyntaxKind.PredefinedType"/></description></item> 361/// <item><description><see cref="SyntaxKind.ArrayType"/></description></item> 420/// <item><description><see cref="SyntaxKind.ArrayRankSpecifier"/></description></item> 475/// <item><description><see cref="SyntaxKind.PointerType"/></description></item> 519/// <item><description><see cref="SyntaxKind.FunctionPointerType"/></description></item> 587/// <item><description><see cref="SyntaxKind.FunctionPointerParameterList"/></description></item> 645/// <item><description><see cref="SyntaxKind.FunctionPointerCallingConvention"/></description></item> 696/// <item><description><see cref="SyntaxKind.FunctionPointerUnmanagedCallingConventionList"/></description></item> 754/// <item><description><see cref="SyntaxKind.FunctionPointerUnmanagedCallingConvention"/></description></item> 794/// <item><description><see cref="SyntaxKind.NullableType"/></description></item> 839/// <item><description><see cref="SyntaxKind.TupleType"/></description></item> 896/// <item><description><see cref="SyntaxKind.TupleElement"/></description></item> 948/// <item><description><see cref="SyntaxKind.OmittedTypeArgument"/></description></item> 988/// <item><description><see cref="SyntaxKind.RefType"/></description></item> 1042/// <item><description><see cref="SyntaxKind.ScopedType"/></description></item> 1102/// <item><description><see cref="SyntaxKind.ParenthesizedExpression"/></description></item> 1151/// <item><description><see cref="SyntaxKind.TupleExpression"/></description></item> 1209/// <item><description><see cref="SyntaxKind.UnaryPlusExpression"/></description></item> 1210/// <item><description><see cref="SyntaxKind.UnaryMinusExpression"/></description></item> 1211/// <item><description><see cref="SyntaxKind.BitwiseNotExpression"/></description></item> 1212/// <item><description><see cref="SyntaxKind.LogicalNotExpression"/></description></item> 1213/// <item><description><see cref="SyntaxKind.PreIncrementExpression"/></description></item> 1214/// <item><description><see cref="SyntaxKind.PreDecrementExpression"/></description></item> 1215/// <item><description><see cref="SyntaxKind.AddressOfExpression"/></description></item> 1216/// <item><description><see cref="SyntaxKind.PointerIndirectionExpression"/></description></item> 1217/// <item><description><see cref="SyntaxKind.IndexExpression"/></description></item> 1262/// <item><description><see cref="SyntaxKind.AwaitExpression"/></description></item> 1307/// <item><description><see cref="SyntaxKind.PostIncrementExpression"/></description></item> 1308/// <item><description><see cref="SyntaxKind.PostDecrementExpression"/></description></item> 1309/// <item><description><see cref="SyntaxKind.SuppressNullableWarningExpression"/></description></item> 1354/// <item><description><see cref="SyntaxKind.SimpleMemberAccessExpression"/></description></item> 1355/// <item><description><see cref="SyntaxKind.PointerMemberAccessExpression"/></description></item> 1417/// <item><description><see cref="SyntaxKind.ConditionalAccessExpression"/></description></item> 1479/// <item><description><see cref="SyntaxKind.MemberBindingExpression"/></description></item> 1524/// <item><description><see cref="SyntaxKind.ElementBindingExpression"/></description></item> 1567/// <item><description><see cref="SyntaxKind.RangeExpression"/></description></item> 1629/// <item><description><see cref="SyntaxKind.ImplicitElementAccess"/></description></item> 1672/// <item><description><see cref="SyntaxKind.AddExpression"/></description></item> 1673/// <item><description><see cref="SyntaxKind.SubtractExpression"/></description></item> 1674/// <item><description><see cref="SyntaxKind.MultiplyExpression"/></description></item> 1675/// <item><description><see cref="SyntaxKind.DivideExpression"/></description></item> 1676/// <item><description><see cref="SyntaxKind.ModuloExpression"/></description></item> 1677/// <item><description><see cref="SyntaxKind.LeftShiftExpression"/></description></item> 1678/// <item><description><see cref="SyntaxKind.RightShiftExpression"/></description></item> 1679/// <item><description><see cref="SyntaxKind.UnsignedRightShiftExpression"/></description></item> 1680/// <item><description><see cref="SyntaxKind.LogicalOrExpression"/></description></item> 1681/// <item><description><see cref="SyntaxKind.LogicalAndExpression"/></description></item> 1682/// <item><description><see cref="SyntaxKind.BitwiseOrExpression"/></description></item> 1683/// <item><description><see cref="SyntaxKind.BitwiseAndExpression"/></description></item> 1684/// <item><description><see cref="SyntaxKind.ExclusiveOrExpression"/></description></item> 1685/// <item><description><see cref="SyntaxKind.EqualsExpression"/></description></item> 1686/// <item><description><see cref="SyntaxKind.NotEqualsExpression"/></description></item> 1687/// <item><description><see cref="SyntaxKind.LessThanExpression"/></description></item> 1688/// <item><description><see cref="SyntaxKind.LessThanOrEqualExpression"/></description></item> 1689/// <item><description><see cref="SyntaxKind.GreaterThanExpression"/></description></item> 1690/// <item><description><see cref="SyntaxKind.GreaterThanOrEqualExpression"/></description></item> 1691/// <item><description><see cref="SyntaxKind.IsExpression"/></description></item> 1692/// <item><description><see cref="SyntaxKind.AsExpression"/></description></item> 1693/// <item><description><see cref="SyntaxKind.CoalesceExpression"/></description></item> 1755/// <item><description><see cref="SyntaxKind.SimpleAssignmentExpression"/></description></item> 1756/// <item><description><see cref="SyntaxKind.AddAssignmentExpression"/></description></item> 1757/// <item><description><see cref="SyntaxKind.SubtractAssignmentExpression"/></description></item> 1758/// <item><description><see cref="SyntaxKind.MultiplyAssignmentExpression"/></description></item> 1759/// <item><description><see cref="SyntaxKind.DivideAssignmentExpression"/></description></item> 1760/// <item><description><see cref="SyntaxKind.ModuloAssignmentExpression"/></description></item> 1761/// <item><description><see cref="SyntaxKind.AndAssignmentExpression"/></description></item> 1762/// <item><description><see cref="SyntaxKind.ExclusiveOrAssignmentExpression"/></description></item> 1763/// <item><description><see cref="SyntaxKind.OrAssignmentExpression"/></description></item> 1764/// <item><description><see cref="SyntaxKind.LeftShiftAssignmentExpression"/></description></item> 1765/// <item><description><see cref="SyntaxKind.RightShiftAssignmentExpression"/></description></item> 1766/// <item><description><see cref="SyntaxKind.UnsignedRightShiftAssignmentExpression"/></description></item> 1767/// <item><description><see cref="SyntaxKind.CoalesceAssignmentExpression"/></description></item> 1829/// <item><description><see cref="SyntaxKind.ConditionalExpression"/></description></item> 1911/// <item><description><see cref="SyntaxKind.ThisExpression"/></description></item> 1951/// <item><description><see cref="SyntaxKind.BaseExpression"/></description></item> 1991/// <item><description><see cref="SyntaxKind.ArgListExpression"/></description></item> 1992/// <item><description><see cref="SyntaxKind.NumericLiteralExpression"/></description></item> 1993/// <item><description><see cref="SyntaxKind.StringLiteralExpression"/></description></item> 1994/// <item><description><see cref="SyntaxKind.Utf8StringLiteralExpression"/></description></item> 1995/// <item><description><see cref="SyntaxKind.CharacterLiteralExpression"/></description></item> 1996/// <item><description><see cref="SyntaxKind.TrueLiteralExpression"/></description></item> 1997/// <item><description><see cref="SyntaxKind.FalseLiteralExpression"/></description></item> 1998/// <item><description><see cref="SyntaxKind.NullLiteralExpression"/></description></item> 1999/// <item><description><see cref="SyntaxKind.DefaultLiteralExpression"/></description></item> 2039/// <item><description><see cref="SyntaxKind.FieldExpression"/></description></item> 2079/// <item><description><see cref="SyntaxKind.MakeRefExpression"/></description></item> 2132/// <item><description><see cref="SyntaxKind.RefTypeExpression"/></description></item> 2185/// <item><description><see cref="SyntaxKind.RefValueExpression"/></description></item> 2259/// <item><description><see cref="SyntaxKind.CheckedExpression"/></description></item> 2260/// <item><description><see cref="SyntaxKind.UncheckedExpression"/></description></item> 2313/// <item><description><see cref="SyntaxKind.DefaultExpression"/></description></item> 2366/// <item><description><see cref="SyntaxKind.TypeOfExpression"/></description></item> 2419/// <item><description><see cref="SyntaxKind.SizeOfExpression"/></description></item> 2472/// <item><description><see cref="SyntaxKind.InvocationExpression"/></description></item> 2532/// <item><description><see cref="SyntaxKind.ElementAccessExpression"/></description></item> 2609/// <item><description><see cref="SyntaxKind.ArgumentList"/></description></item> 2669/// <item><description><see cref="SyntaxKind.BracketedArgumentList"/></description></item> 2729/// <item><description><see cref="SyntaxKind.Argument"/></description></item> 2813/// <item><description><see cref="SyntaxKind.ExpressionColon"/></description></item> 2858/// <item><description><see cref="SyntaxKind.NameColon"/></description></item> 2904/// <item><description><see cref="SyntaxKind.DeclarationExpression"/></description></item> 2961/// <item><description><see cref="SyntaxKind.CastExpression"/></description></item> 3065/// <item><description><see cref="SyntaxKind.AnonymousMethodExpression"/></description></item> 3196/// <item><description><see cref="SyntaxKind.SimpleLambdaExpression"/></description></item> 3310/// <item><description><see cref="SyntaxKind.RefExpression"/></description></item> 3353/// <item><description><see cref="SyntaxKind.ParenthesizedLambdaExpression"/></description></item> 3473/// <item><description><see cref="SyntaxKind.ObjectInitializerExpression"/></description></item> 3474/// <item><description><see cref="SyntaxKind.CollectionInitializerExpression"/></description></item> 3475/// <item><description><see cref="SyntaxKind.ArrayInitializerExpression"/></description></item> 3476/// <item><description><see cref="SyntaxKind.ComplexElementInitializerExpression"/></description></item> 3477/// <item><description><see cref="SyntaxKind.WithInitializerExpression"/></description></item> 3561/// <item><description><see cref="SyntaxKind.ImplicitObjectCreationExpression"/></description></item> 3629/// <item><description><see cref="SyntaxKind.ObjectCreationExpression"/></description></item> 3707/// <item><description><see cref="SyntaxKind.WithExpression"/></description></item> 3768/// <item><description><see cref="SyntaxKind.AnonymousObjectMemberDeclarator"/></description></item> 3826/// <item><description><see cref="SyntaxKind.AnonymousObjectCreationExpression"/></description></item> 3888/// <item><description><see cref="SyntaxKind.ArrayCreationExpression"/></description></item> 3952/// <item><description><see cref="SyntaxKind.ImplicitArrayCreationExpression"/></description></item> 4019/// <item><description><see cref="SyntaxKind.StackAllocArrayCreationExpression"/></description></item> 4081/// <item><description><see cref="SyntaxKind.ImplicitStackAllocArrayCreationExpression"/></description></item> 4135/// <item><description><see cref="SyntaxKind.CollectionExpression"/></description></item> 4198/// <item><description><see cref="SyntaxKind.ExpressionElement"/></description></item> 4237/// <item><description><see cref="SyntaxKind.SpreadElement"/></description></item> 4279/// <item><description><see cref="SyntaxKind.WithElement"/></description></item> 4340/// <item><description><see cref="SyntaxKind.QueryExpression"/></description></item> 4397/// <item><description><see cref="SyntaxKind.QueryBody"/></description></item> 4460/// <item><description><see cref="SyntaxKind.FromClause"/></description></item> 4525/// <item><description><see cref="SyntaxKind.LetClause"/></description></item> 4574/// <item><description><see cref="SyntaxKind.JoinClause"/></description></item> 4663/// <item><description><see cref="SyntaxKind.JoinIntoClause"/></description></item> 4705/// <item><description><see cref="SyntaxKind.WhereClause"/></description></item> 4747/// <item><description><see cref="SyntaxKind.OrderByClause"/></description></item> 4798/// <item><description><see cref="SyntaxKind.AscendingOrdering"/></description></item> 4799/// <item><description><see cref="SyntaxKind.DescendingOrdering"/></description></item> 4848/// <item><description><see cref="SyntaxKind.SelectClause"/></description></item> 4890/// <item><description><see cref="SyntaxKind.GroupClause"/></description></item> 4951/// <item><description><see cref="SyntaxKind.QueryContinuation"/></description></item> 5000/// <item><description><see cref="SyntaxKind.OmittedArraySizeExpression"/></description></item> 5039/// <item><description><see cref="SyntaxKind.InterpolatedStringExpression"/></description></item> 5090/// <item><description><see cref="SyntaxKind.IsPatternExpression"/></description></item> 5150/// <item><description><see cref="SyntaxKind.ThrowExpression"/></description></item> 5192/// <item><description><see cref="SyntaxKind.WhenClause"/></description></item> 5242/// <item><description><see cref="SyntaxKind.DiscardPattern"/></description></item> 5280/// <item><description><see cref="SyntaxKind.DeclarationPattern"/></description></item> 5335/// <item><description><see cref="SyntaxKind.VarPattern"/></description></item> 5377/// <item><description><see cref="SyntaxKind.RecursivePattern"/></description></item> 5455/// <item><description><see cref="SyntaxKind.PositionalPatternClause"/></description></item> 5509/// <item><description><see cref="SyntaxKind.PropertyPatternClause"/></description></item> 5563/// <item><description><see cref="SyntaxKind.Subpattern"/></description></item> 5618/// <item><description><see cref="SyntaxKind.ConstantPattern"/></description></item> 5658/// <item><description><see cref="SyntaxKind.ParenthesizedPattern"/></description></item> 5703/// <item><description><see cref="SyntaxKind.RelationalPattern"/></description></item> 5746/// <item><description><see cref="SyntaxKind.TypePattern"/></description></item> 5786/// <item><description><see cref="SyntaxKind.OrPattern"/></description></item> 5787/// <item><description><see cref="SyntaxKind.AndPattern"/></description></item> 5845/// <item><description><see cref="SyntaxKind.NotPattern"/></description></item> 5887/// <item><description><see cref="SyntaxKind.ListPattern"/></description></item> 5957/// <item><description><see cref="SyntaxKind.SlicePattern"/></description></item> 6007/// <item><description><see cref="SyntaxKind.InterpolatedStringText"/></description></item> 6046/// <item><description><see cref="SyntaxKind.Interpolation"/></description></item> 6117/// <item><description><see cref="SyntaxKind.InterpolationAlignmentClause"/></description></item> 6159/// <item><description><see cref="SyntaxKind.InterpolationFormatClause"/></description></item> 6202/// <item><description><see cref="SyntaxKind.GlobalStatement"/></description></item> 6290/// <item><description><see cref="SyntaxKind.Block"/></description></item> 6356/// <item><description><see cref="SyntaxKind.LocalFunctionStatement"/></description></item> 6488/// <item><description><see cref="SyntaxKind.LocalDeclarationStatement"/></description></item> 6583/// <item><description><see cref="SyntaxKind.VariableDeclaration"/></description></item> 6647/// <item><description><see cref="SyntaxKind.VariableDeclarator"/></description></item> 6712/// <item><description><see cref="SyntaxKind.EqualsValueClause"/></description></item> 6762/// <item><description><see cref="SyntaxKind.SingleVariableDesignation"/></description></item> 6800/// <item><description><see cref="SyntaxKind.DiscardDesignation"/></description></item> 6838/// <item><description><see cref="SyntaxKind.ParenthesizedVariableDesignation"/></description></item> 6892/// <item><description><see cref="SyntaxKind.ExpressionStatement"/></description></item> 6954/// <item><description><see cref="SyntaxKind.EmptyStatement"/></description></item> 7001/// <item><description><see cref="SyntaxKind.LabeledStatement"/></description></item> 7071/// <item><description><see cref="SyntaxKind.GotoStatement"/></description></item> 7072/// <item><description><see cref="SyntaxKind.GotoCaseStatement"/></description></item> 7073/// <item><description><see cref="SyntaxKind.GotoDefaultStatement"/></description></item> 7160/// <item><description><see cref="SyntaxKind.BreakStatement"/></description></item> 7209/// <item><description><see cref="SyntaxKind.ContinueStatement"/></description></item> 7258/// <item><description><see cref="SyntaxKind.ReturnStatement"/></description></item> 7323/// <item><description><see cref="SyntaxKind.ThrowStatement"/></description></item> 7388/// <item><description><see cref="SyntaxKind.YieldReturnStatement"/></description></item> 7389/// <item><description><see cref="SyntaxKind.YieldBreakStatement"/></description></item> 7457/// <item><description><see cref="SyntaxKind.WhileStatement"/></description></item> 7531/// <item><description><see cref="SyntaxKind.DoStatement"/></description></item> 7611/// <item><description><see cref="SyntaxKind.ForStatement"/></description></item> 7765/// <item><description><see cref="SyntaxKind.ForEachStatement"/></description></item> 7869/// <item><description><see cref="SyntaxKind.ForEachVariableStatement"/></description></item> 7975/// <item><description><see cref="SyntaxKind.UsingStatement"/></description></item> 8065/// <item><description><see cref="SyntaxKind.FixedStatement"/></description></item> 8140/// <item><description><see cref="SyntaxKind.CheckedStatement"/></description></item> 8141/// <item><description><see cref="SyntaxKind.UncheckedStatement"/></description></item> 8205/// <item><description><see cref="SyntaxKind.UnsafeStatement"/></description></item> 8269/// <item><description><see cref="SyntaxKind.LockStatement"/></description></item> 8346/// <item><description><see cref="SyntaxKind.IfStatement"/></description></item> 8445/// <item><description><see cref="SyntaxKind.ElseClause"/></description></item> 8491/// <item><description><see cref="SyntaxKind.SwitchStatement"/></description></item> 8608/// <item><description><see cref="SyntaxKind.SwitchSection"/></description></item> 8696/// <item><description><see cref="SyntaxKind.CasePatternSwitchLabel"/></description></item> 8764/// <item><description><see cref="SyntaxKind.CaseSwitchLabel"/></description></item> 8816/// <item><description><see cref="SyntaxKind.DefaultSwitchLabel"/></description></item> 8860/// <item><description><see cref="SyntaxKind.SwitchExpression"/></description></item> 8933/// <item><description><see cref="SyntaxKind.SwitchExpressionArm"/></description></item> 8997/// <item><description><see cref="SyntaxKind.TryStatement"/></description></item> 9074/// <item><description><see cref="SyntaxKind.CatchClause"/></description></item> 9141/// <item><description><see cref="SyntaxKind.CatchDeclaration"/></description></item> 9196/// <item><description><see cref="SyntaxKind.CatchFilterClause"/></description></item> 9244/// <item><description><see cref="SyntaxKind.FinallyClause"/></description></item> 9289/// <item><description><see cref="SyntaxKind.CompilationUnit"/></description></item> 9368/// <item><description><see cref="SyntaxKind.ExternAliasDirective"/></description></item> 9419/// <item><description><see cref="SyntaxKind.UsingDirective"/></description></item> 9579/// <item><description><see cref="SyntaxKind.NamespaceDeclaration"/></description></item> 9700/// <item><description><see cref="SyntaxKind.FileScopedNamespaceDeclaration"/></description></item> 9808/// <item><description><see cref="SyntaxKind.AttributeList"/></description></item> 9883/// <item><description><see cref="SyntaxKind.AttributeTargetSpecifier"/></description></item> 9927/// <item><description><see cref="SyntaxKind.Attribute"/></description></item> 9990/// <item><description><see cref="SyntaxKind.AttributeArgumentList"/></description></item> 10048/// <item><description><see cref="SyntaxKind.AttributeArgument"/></description></item> 10111/// <item><description><see cref="SyntaxKind.NameEquals"/></description></item> 10155/// <item><description><see cref="SyntaxKind.TypeParameterList"/></description></item> 10213/// <item><description><see cref="SyntaxKind.TypeParameter"/></description></item> 10366/// <item><description><see cref="SyntaxKind.ClassDeclaration"/></description></item> 10532/// <item><description><see cref="SyntaxKind.StructDeclaration"/></description></item> 10533/// <item><description><see cref="SyntaxKind.UnionDeclaration"/></description></item> 10699/// <item><description><see cref="SyntaxKind.InterfaceDeclaration"/></description></item> 10864/// <item><description><see cref="SyntaxKind.RecordDeclaration"/></description></item> 10865/// <item><description><see cref="SyntaxKind.RecordStructDeclaration"/></description></item> 11040/// <item><description><see cref="SyntaxKind.EnumDeclaration"/></description></item> 11177/// <item><description><see cref="SyntaxKind.DelegateDeclaration"/></description></item> 11289/// <item><description><see cref="SyntaxKind.EnumMemberDeclaration"/></description></item> 11366/// <item><description><see cref="SyntaxKind.ExtensionBlockDeclaration"/></description></item> 11514/// <item><description><see cref="SyntaxKind.BaseList"/></description></item> 11580/// <item><description><see cref="SyntaxKind.SimpleBaseType"/></description></item> 11620/// <item><description><see cref="SyntaxKind.PrimaryConstructorBaseType"/></description></item> 11679/// <item><description><see cref="SyntaxKind.TypeParameterConstraintClause"/></description></item> 11762/// <item><description><see cref="SyntaxKind.ConstructorConstraint"/></description></item> 11810/// <item><description><see cref="SyntaxKind.ClassConstraint"/></description></item> 11811/// <item><description><see cref="SyntaxKind.StructConstraint"/></description></item> 11862/// <item><description><see cref="SyntaxKind.TypeConstraint"/></description></item> 11903/// <item><description><see cref="SyntaxKind.DefaultConstraint"/></description></item> 11943/// <item><description><see cref="SyntaxKind.AllowsConstraintClause"/></description></item> 12005/// <item><description><see cref="SyntaxKind.RefStructConstraint"/></description></item> 12074/// <item><description><see cref="SyntaxKind.FieldDeclaration"/></description></item> 12153/// <item><description><see cref="SyntaxKind.EventFieldDeclaration"/></description></item> 12235/// <item><description><see cref="SyntaxKind.ExplicitInterfaceSpecifier"/></description></item> 12321/// <item><description><see cref="SyntaxKind.MethodDeclaration"/></description></item> 12471/// <item><description><see cref="SyntaxKind.OperatorDeclaration"/></description></item> 12617/// <item><description><see cref="SyntaxKind.ConversionOperatorDeclaration"/></description></item> 12763/// <item><description><see cref="SyntaxKind.ConstructorDeclaration"/></description></item> 12887/// <item><description><see cref="SyntaxKind.BaseConstructorInitializer"/></description></item> 12888/// <item><description><see cref="SyntaxKind.ThisConstructorInitializer"/></description></item> 12938/// <item><description><see cref="SyntaxKind.DestructorDeclaration"/></description></item> 13092/// <item><description><see cref="SyntaxKind.PropertyDeclaration"/></description></item> 13212/// <item><description><see cref="SyntaxKind.ArrowExpressionClause"/></description></item> 13254/// <item><description><see cref="SyntaxKind.EventDeclaration"/></description></item> 13364/// <item><description><see cref="SyntaxKind.IndexerDeclaration"/></description></item> 13484/// <item><description><see cref="SyntaxKind.AccessorList"/></description></item> 13531/// <item><description><see cref="SyntaxKind.GetAccessorDeclaration"/></description></item> 13532/// <item><description><see cref="SyntaxKind.SetAccessorDeclaration"/></description></item> 13533/// <item><description><see cref="SyntaxKind.InitAccessorDeclaration"/></description></item> 13534/// <item><description><see cref="SyntaxKind.AddAccessorDeclaration"/></description></item> 13535/// <item><description><see cref="SyntaxKind.RemoveAccessorDeclaration"/></description></item> 13536/// <item><description><see cref="SyntaxKind.UnknownAccessorDeclaration"/></description></item> 13657/// <item><description><see cref="SyntaxKind.ParameterList"/></description></item> 13716/// <item><description><see cref="SyntaxKind.BracketedParameterList"/></description></item> 13804/// <item><description><see cref="SyntaxKind.Parameter"/></description></item> 13900/// <item><description><see cref="SyntaxKind.FunctionPointerParameter"/></description></item> 13975/// <item><description><see cref="SyntaxKind.IncompleteMember"/></description></item> 14047/// <item><description><see cref="SyntaxKind.SkippedTokensTrivia"/></description></item> 14094/// <item><description><see cref="SyntaxKind.SingleLineDocumentationCommentTrivia"/></description></item> 14095/// <item><description><see cref="SyntaxKind.MultiLineDocumentationCommentTrivia"/></description></item> 14158/// <item><description><see cref="SyntaxKind.TypeCref"/></description></item> 14204/// <item><description><see cref="SyntaxKind.QualifiedCref"/></description></item> 14283/// <item><description><see cref="SyntaxKind.NameMemberCref"/></description></item> 14344/// <item><description><see cref="SyntaxKind.ExtensionMemberCref"/></description></item> 14422/// <item><description><see cref="SyntaxKind.IndexerMemberCref"/></description></item> 14475/// <item><description><see cref="SyntaxKind.OperatorMemberCref"/></description></item> 14541/// <item><description><see cref="SyntaxKind.ConversionOperatorMemberCref"/></description></item> 14641/// <item><description><see cref="SyntaxKind.CrefParameterList"/></description></item> 14702/// <item><description><see cref="SyntaxKind.CrefBracketedParameterList"/></description></item> 14766/// <item><description><see cref="SyntaxKind.CrefParameter"/></description></item> 14833/// <item><description><see cref="SyntaxKind.XmlElement"/></description></item> 14897/// <item><description><see cref="SyntaxKind.XmlElementStartTag"/></description></item> 14960/// <item><description><see cref="SyntaxKind.XmlElementEndTag"/></description></item> 15005/// <item><description><see cref="SyntaxKind.XmlEmptyElement"/></description></item> 15068/// <item><description><see cref="SyntaxKind.XmlName"/></description></item> 15110/// <item><description><see cref="SyntaxKind.XmlPrefix"/></description></item> 15175/// <item><description><see cref="SyntaxKind.XmlTextAttribute"/></description></item> 15239/// <item><description><see cref="SyntaxKind.XmlCrefAttribute"/></description></item> 15307/// <item><description><see cref="SyntaxKind.XmlNameAttribute"/></description></item> 15375/// <item><description><see cref="SyntaxKind.XmlText"/></description></item> 15422/// <item><description><see cref="SyntaxKind.XmlCDataSection"/></description></item> 15475/// <item><description><see cref="SyntaxKind.XmlProcessingInstruction"/></description></item> 15532/// <item><description><see cref="SyntaxKind.XmlComment"/></description></item> 15630/// <item><description><see cref="SyntaxKind.IfDirectiveTrivia"/></description></item> 15690/// <item><description><see cref="SyntaxKind.ElifDirectiveTrivia"/></description></item> 15750/// <item><description><see cref="SyntaxKind.ElseDirectiveTrivia"/></description></item> 15802/// <item><description><see cref="SyntaxKind.EndIfDirectiveTrivia"/></description></item> 15851/// <item><description><see cref="SyntaxKind.RegionDirectiveTrivia"/></description></item> 15900/// <item><description><see cref="SyntaxKind.EndRegionDirectiveTrivia"/></description></item> 15949/// <item><description><see cref="SyntaxKind.ErrorDirectiveTrivia"/></description></item> 15998/// <item><description><see cref="SyntaxKind.WarningDirectiveTrivia"/></description></item> 16047/// <item><description><see cref="SyntaxKind.BadDirectiveTrivia"/></description></item> 16096/// <item><description><see cref="SyntaxKind.DefineDirectiveTrivia"/></description></item> 16148/// <item><description><see cref="SyntaxKind.UndefDirectiveTrivia"/></description></item> 16219/// <item><description><see cref="SyntaxKind.LineDirectiveTrivia"/></description></item> 16283/// <item><description><see cref="SyntaxKind.LineDirectivePosition"/></description></item> 16333/// <item><description><see cref="SyntaxKind.LineSpanDirectiveTrivia"/></description></item> 16420/// <item><description><see cref="SyntaxKind.PragmaWarningDirectiveTrivia"/></description></item> 16488/// <item><description><see cref="SyntaxKind.PragmaChecksumDirectiveTrivia"/></description></item> 16549/// <item><description><see cref="SyntaxKind.ReferenceDirectiveTrivia"/></description></item> 16601/// <item><description><see cref="SyntaxKind.LoadDirectiveTrivia"/></description></item> 16653/// <item><description><see cref="SyntaxKind.ShebangDirectiveTrivia"/></description></item> 16702/// <item><description><see cref="SyntaxKind.IgnoredDirectiveTrivia"/></description></item> 16761/// <item><description><see cref="SyntaxKind.NullableDirectiveTrivia"/></description></item>
Binder\Binder.cs (2)
89assignment.Parent?.Kind() == SyntaxKind.ObjectInitializerExpression; 93initializer.Kind() == SyntaxKind.ObjectInitializerExpression:
Binder\Binder.IdentifierUsedAsValueFinder.cs (13)
69assignment.Parent?.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.WithInitializerExpression) 77!(id.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && 135case GotoStatementSyntax { RawKind: (int)SyntaxKind.GotoStatement }: 157!(expression.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && 224case MemberAccessExpressionSyntax { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression } memberAccess when memberAccess.Expression == id: 369case SyntaxKind.SelectClause: 380case SyntaxKind.GroupClause: 412case SyntaxKind.WhereClause: 414case SyntaxKind.JoinClause: 416case SyntaxKind.OrderByClause: 418case SyntaxKind.FromClause: 420case SyntaxKind.LetClause:
Binder\Binder.ValueChecks.cs (3)
750Debug.Assert(expr.Syntax.Kind() != SyntaxKind.Argument || valueKind == BindValueKind.RefOrOut); 1286!parenthesized.Expression.IsKind(SyntaxKind.ParenthesizedExpression) && 1297return parenthesized.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.SubtractExpression } binary &&
Binder\Binder_AnonymousTypes.cs (8)
70if (nameToken.Kind() == SyntaxKind.IdentifierToken) 91fieldSyntaxNodes[i] = (nameToken.Kind() == SyntaxKind.IdentifierToken) ? (CSharpSyntaxNode)nameToken.Parent! : fieldInitializer; 157case SyntaxKind.QualifiedName: 160case SyntaxKind.ConditionalAccessExpression: 162if (expr.Kind() == SyntaxKind.MemberBindingExpression) 168case SyntaxKind.IdentifierName: 169case SyntaxKind.SimpleMemberAccessExpression: 224expressionType = CreateErrorType(SyntaxFacts.GetText(SyntaxKind.VoidKeyword));
Binder\Binder_Attributes.cs (1)
290Debug.Assert(boundAttribute.Syntax.Kind() == SyntaxKind.Attribute);
Binder\Binder_Constraints.cs (9)
134case SyntaxKind.ClassConstraint: 152if (questionToken.IsKind(SyntaxKind.QuestionToken)) 175case SyntaxKind.StructConstraint: 193case SyntaxKind.ConstructorConstraint: 209if (i != n - 1 && constraintsSyntax[i + 1].Kind() != SyntaxKind.AllowsConstraintClause) 216case SyntaxKind.DefaultConstraint: 239case SyntaxKind.TypeConstraint: 295case SyntaxKind.AllowsConstraintClause: 312if (allowsConstraint.Kind() == SyntaxKind.RefStructConstraint)
Binder\Binder_Conversions.cs (4)
1791((ParameterSyntax)node).Modifiers.First(static m => m.IsKind(SyntaxKind.ParamsKeyword)).GetLocation(), 3055if (!lambdaSymbol.SyntaxNode.IsKind(SyntaxKind.AnonymousMethodExpression)) 3414else if (node.Kind() == SyntaxKind.AwaitExpression && memberSymbol.Name == WellKnownMemberNames.GetAwaiter) 3436if (node.Parent != null && node.Parent.Kind() == SyntaxKind.InvocationExpression)
Binder\Binder_Crefs.cs (21)
31case SyntaxKind.TypeCref: 33case SyntaxKind.QualifiedCref: 35case SyntaxKind.NameMemberCref: 36case SyntaxKind.IndexerMemberCref: 37case SyntaxKind.OperatorMemberCref: 38case SyntaxKind.ConversionOperatorMemberCref: 39case SyntaxKind.ExtensionMemberCref: 118case SyntaxKind.NameMemberCref: 121case SyntaxKind.IndexerMemberCref: 124case SyntaxKind.OperatorMemberCref: 127case SyntaxKind.ConversionOperatorMemberCref: 130case SyntaxKind.ExtensionMemberCref: 420bool isChecked = syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword); 422SyntaxKind operatorTokenKind = syntax.OperatorToken.Kind(); 442if (operatorTokenKind is SyntaxKind.PlusPlusToken or SyntaxKind.MinusMinusToken && parameterListSyntax?.Parameters.Count == 0) 466bool isChecked = syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword); 470if (syntax.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword) 1137if (refKind == RefKind.Ref && parameter.ReadOnlyKeyword.IsKind(SyntaxKind.ReadOnlyKeyword)) 1183if (typeSyntax.Parent.Kind() == SyntaxKind.ConversionOperatorMemberCref) 1229return parentSyntax == null || parentSyntax.IsKind(SyntaxKind.XmlCrefAttribute)
Binder\Binder_Deconstruct.cs (13)
42case SyntaxKind.ExpressionStatement: 49case SyntaxKind.ForStatement: 180if (parent is null || parent.Kind() == SyntaxKind.ForEachVariableStatement) 185Debug.Assert(parent.Kind() == SyntaxKind.SimpleAssignmentExpression); 195case SyntaxKind.ExpressionStatement: 198case SyntaxKind.ForStatement: 304var elementSyntax = syntax.Kind() == SyntaxKind.TupleExpression ? ((TupleExpressionSyntax)syntax).Arguments[i] : syntax; 743case SyntaxKind.DeclarationExpression: 756if (component.Designation.Kind() == SyntaxKind.ParenthesizedVariableDesignation) 774case SyntaxKind.TupleExpression: 812case SyntaxKind.SingleVariableDesignation: 817case SyntaxKind.DiscardDesignation: 839case SyntaxKind.ParenthesizedVariableDesignation:
Binder\Binder_Expressions.cs (220)
632case SyntaxKind.AnonymousMethodExpression: 633case SyntaxKind.ParenthesizedLambdaExpression: 634case SyntaxKind.SimpleLambdaExpression: 636case SyntaxKind.ThisExpression: 638case SyntaxKind.BaseExpression: 640case SyntaxKind.FieldExpression: 642case SyntaxKind.InvocationExpression: 644case SyntaxKind.ArrayInitializerExpression: 646case SyntaxKind.ArrayCreationExpression: 648case SyntaxKind.ImplicitArrayCreationExpression: 650case SyntaxKind.StackAllocArrayCreationExpression: 652case SyntaxKind.ImplicitStackAllocArrayCreationExpression: 654case SyntaxKind.ObjectCreationExpression: 656case SyntaxKind.ImplicitObjectCreationExpression: 658case SyntaxKind.IdentifierName: 659case SyntaxKind.GenericName: 661case SyntaxKind.SimpleMemberAccessExpression: 662case SyntaxKind.PointerMemberAccessExpression: 664case SyntaxKind.SimpleAssignmentExpression: 666case SyntaxKind.CastExpression: 668case SyntaxKind.ElementAccessExpression: 670case SyntaxKind.AddExpression: 671case SyntaxKind.MultiplyExpression: 672case SyntaxKind.SubtractExpression: 673case SyntaxKind.DivideExpression: 674case SyntaxKind.ModuloExpression: 675case SyntaxKind.EqualsExpression: 676case SyntaxKind.NotEqualsExpression: 677case SyntaxKind.GreaterThanExpression: 678case SyntaxKind.LessThanExpression: 679case SyntaxKind.GreaterThanOrEqualExpression: 680case SyntaxKind.LessThanOrEqualExpression: 681case SyntaxKind.BitwiseAndExpression: 682case SyntaxKind.BitwiseOrExpression: 683case SyntaxKind.ExclusiveOrExpression: 684case SyntaxKind.LeftShiftExpression: 685case SyntaxKind.RightShiftExpression: 686case SyntaxKind.UnsignedRightShiftExpression: 689case SyntaxKind.LogicalAndExpression: 690case SyntaxKind.LogicalOrExpression: 692case SyntaxKind.CoalesceExpression: 694case SyntaxKind.ConditionalAccessExpression: 697case SyntaxKind.MemberBindingExpression: 700case SyntaxKind.ElementBindingExpression: 703case SyntaxKind.IsExpression: 706case SyntaxKind.AsExpression: 709case SyntaxKind.UnaryPlusExpression: 710case SyntaxKind.UnaryMinusExpression: 711case SyntaxKind.LogicalNotExpression: 712case SyntaxKind.BitwiseNotExpression: 715case SyntaxKind.IndexExpression: 718case SyntaxKind.RangeExpression: 721case SyntaxKind.AddressOfExpression: 724case SyntaxKind.PointerIndirectionExpression: 727case SyntaxKind.PostIncrementExpression: 728case SyntaxKind.PostDecrementExpression: 731case SyntaxKind.PreIncrementExpression: 732case SyntaxKind.PreDecrementExpression: 735case SyntaxKind.ConditionalExpression: 738case SyntaxKind.SwitchExpression: 741case SyntaxKind.NumericLiteralExpression: 742case SyntaxKind.StringLiteralExpression: 743case SyntaxKind.CharacterLiteralExpression: 744case SyntaxKind.TrueLiteralExpression: 745case SyntaxKind.FalseLiteralExpression: 746case SyntaxKind.NullLiteralExpression: 749case SyntaxKind.Utf8StringLiteralExpression: 752case SyntaxKind.DefaultLiteralExpression: 756case SyntaxKind.ParenthesizedExpression: 761case SyntaxKind.UncheckedExpression: 762case SyntaxKind.CheckedExpression: 765case SyntaxKind.DefaultExpression: 768case SyntaxKind.TypeOfExpression: 771case SyntaxKind.SizeOfExpression: 774case SyntaxKind.AddAssignmentExpression: 775case SyntaxKind.AndAssignmentExpression: 776case SyntaxKind.DivideAssignmentExpression: 777case SyntaxKind.ExclusiveOrAssignmentExpression: 778case SyntaxKind.LeftShiftAssignmentExpression: 779case SyntaxKind.ModuloAssignmentExpression: 780case SyntaxKind.MultiplyAssignmentExpression: 781case SyntaxKind.OrAssignmentExpression: 782case SyntaxKind.RightShiftAssignmentExpression: 783case SyntaxKind.UnsignedRightShiftAssignmentExpression: 784case SyntaxKind.SubtractAssignmentExpression: 787case SyntaxKind.CoalesceAssignmentExpression: 790case SyntaxKind.AliasQualifiedName: 791case SyntaxKind.PredefinedType: 794case SyntaxKind.QueryExpression: 797case SyntaxKind.AnonymousObjectCreationExpression: 800case SyntaxKind.QualifiedName: 803case SyntaxKind.ComplexElementInitializerExpression: 806case SyntaxKind.ArgListExpression: 809case SyntaxKind.RefTypeExpression: 812case SyntaxKind.MakeRefExpression: 815case SyntaxKind.RefValueExpression: 818case SyntaxKind.AwaitExpression: 821case SyntaxKind.OmittedArraySizeExpression: 822case SyntaxKind.OmittedTypeArgument: 823case SyntaxKind.ObjectInitializerExpression: 828case SyntaxKind.CollectionExpression: 831case SyntaxKind.NullableType: 840case SyntaxKind.InterpolatedStringExpression: 843case SyntaxKind.IsPatternExpression: 846case SyntaxKind.TupleExpression: 849case SyntaxKind.ThrowExpression: 852case SyntaxKind.RefType: 855case SyntaxKind.ScopedType: 858case SyntaxKind.RefExpression: 861case SyntaxKind.DeclarationExpression: 864case SyntaxKind.SuppressNullableWarningExpression: 867case SyntaxKind.WithExpression: 936case SyntaxKind.ConditionalExpression: // ?: 941case SyntaxKind.CoalesceExpression: // ?? 946case SyntaxKind.SwitchExpressionArm: 947case SyntaxKind.ArrowExpressionClause: 948case SyntaxKind.ParenthesizedLambdaExpression: 949case SyntaxKind.SimpleLambdaExpression: 983case SyntaxKind.SingleVariableDesignation: 989case SyntaxKind.DiscardDesignation: 993case SyntaxKind.ParenthesizedVariableDesignation: 1680SeparatedSyntaxList<TypeSyntax> typeArgumentList = node.Kind() == SyntaxKind.GenericName 1735if (!isNamedType && (hasTypeArguments || node.Kind() == SyntaxKind.GenericName)) 1941return (parent?.Kind() == SyntaxKind.Argument && 1942((ArgumentSyntax)parent).RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword); 2486if (node.Kind() == SyntaxKind.PredefinedType) 2644else if (this.ContainingType is null || node.Parent is null || (node.Parent.Kind() != SyntaxKind.SimpleMemberAccessExpression && node.Parent.Kind() != SyntaxKind.ElementAccessExpression)) 2678Debug.Assert(node.OperatorToken.IsKind(SyntaxKind.CaretToken)); 3072case SyntaxKind.PredefinedType: 3075case SyntaxKind.SimpleLambdaExpression: 3078case SyntaxKind.ParenthesizedExpression: 3081case SyntaxKind.CastExpression: 3084case SyntaxKind.SimpleMemberAccessExpression: 3085case SyntaxKind.PointerMemberAccessExpression: 3087case SyntaxKind.MemberBindingExpression: 3145case SyntaxKind.ParenthesizedLambdaExpression: 3146case SyntaxKind.SimpleLambdaExpression: 3147case SyntaxKind.AnonymousMethodExpression: 3148case SyntaxKind.InvocationExpression: 3149case SyntaxKind.ObjectCreationExpression: 3150case SyntaxKind.ImplicitObjectCreationExpression: 3151case SyntaxKind.ParenthesizedExpression: // this is never allowed in legacy compiler 3152case SyntaxKind.DeclarationExpression: 3202if (argumentSyntax.RefOrOutKeyword.Kind() != SyntaxKind.None) 3210if (argumentSyntax.RefKindKeyword.IsKind(SyntaxKind.InKeyword)) 3213if (argumentSyntax.Expression.Kind() == SyntaxKind.DeclarationExpression) 3215if (argumentSyntax.RefKindKeyword.IsKind(SyntaxKind.OutKeyword)) 3235case SyntaxKind.DiscardDesignation: 3258case SyntaxKind.SingleVariableDesignation: 4157if (arg.Kind() != SyntaxKind.OmittedArraySizeExpression) 4178if (dimension.Kind() != SyntaxKind.OmittedArraySizeExpression) 4305if (expression.Kind() == SyntaxKind.ArrayInitializerExpression) 4384if (expr.Kind() == SyntaxKind.ArrayInitializerExpression) 4508creationSyntax.Kind() == SyntaxKind.ArrayCreationExpression || 4509creationSyntax.Kind() == SyntaxKind.ImplicitArrayCreationExpression); 4512Debug.Assert(boundInitExprOpt.IsDefault || creationSyntax.Kind() == SyntaxKind.ImplicitArrayCreationExpression); 4542var isInferred = creationSyntax.IsKind(SyntaxKind.ImplicitArrayCreationExpression); 4577initSyntax.Parent.Kind() != SyntaxKind.EqualsValueClause || 4587if (typeSyntax.Kind() != SyntaxKind.ArrayType) 4623if (size.Kind() != SyntaxKind.OmittedArraySizeExpression) 4640if (countSyntax.Kind() != SyntaxKind.OmittedArraySizeExpression) 4698typeSyntax: node.Kind() == SyntaxKind.StackAllocArrayCreationExpression 4719if (!equalsValueClause.IsKind(SyntaxKind.EqualsValueClause)) 4726if (!variableDeclarator.IsKind(SyntaxKind.VariableDeclarator)) 4732if (!variableDeclaration.IsKind(SyntaxKind.VariableDeclaration)) 4738variableDeclaration.Parent.IsKind(SyntaxKind.LocalDeclarationStatement) || 4739variableDeclaration.Parent.IsKind(SyntaxKind.ForStatement); 4754Debug.Assert(node.IsKind(SyntaxKind.ImplicitStackAllocArrayCreationExpression) || node.IsKind(SyntaxKind.StackAllocArrayCreationExpression)); 4791bool isInferred = node.IsKind(SyntaxKind.ImplicitStackAllocArrayCreationExpression); 4940initializerArgumentListOpt.Parent.Kind() != SyntaxKind.ThisConstructorInitializer; 4983Debug.Assert(initializerArgumentListOpt.Parent.Kind() == SyntaxKind.ThisConstructorInitializer); 5090(initializerArgumentListOpt != null && initializerArgumentListOpt.Parent.Kind() == SyntaxKind.ThisConstructorInitializer)); 5698else if (node.Type.Kind() == SyntaxKind.TupleType) 5793case SyntaxKind.ObjectInitializerExpression: 5797case SyntaxKind.WithInitializerExpression: 5801case SyntaxKind.CollectionInitializerExpression: 5822case SyntaxKind.ObjectInitializerExpression: 5823case SyntaxKind.CollectionInitializerExpression: 5824Debug.Assert(syntax.Parent.Parent.Kind() != SyntaxKind.WithInitializerExpression); 5844Debug.Assert(initializerSyntax.Kind() == SyntaxKind.ObjectInitializerExpression || 5845initializerSyntax.Kind() == SyntaxKind.WithInitializerExpression); 5848if (initializerSyntax.Kind() == SyntaxKind.ObjectInitializerExpression) 5882case SyntaxKind.SimpleAssignmentExpression: 5913case SyntaxKind.IdentifierName: 5952SyntaxKind rhsKind = namedAssignment.Right.Kind(); 5953bool isRef = rhsKind is SyntaxKind.RefExpression; 5954bool isRhsNestedInitializer = rhsKind is SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression; 5985if (leftSyntax.Kind() == SyntaxKind.IdentifierName) 6029else if (leftSyntax.Kind() == SyntaxKind.ImplicitElementAccess) 6265Debug.Assert(memberInitializerSyntax.Kind() == SyntaxKind.SimpleAssignmentExpression); 6399Debug.Assert(initializerSyntax.Kind() == SyntaxKind.CollectionInitializerExpression); 6487if (elementInitializer.Kind() == SyntaxKind.ComplexElementInitializerExpression) 6553Debug.Assert(node.Kind() == SyntaxKind.ComplexElementInitializerExpression); 7528if (node.Kind() is SyntaxKind.NumericLiteralExpression) 7571if (node.Token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken) 7581Debug.Assert(node.Kind() == SyntaxKind.Utf8StringLiteralExpression); 7582Debug.Assert(node.Token.Kind() is SyntaxKind.Utf8StringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken); 7584if (node.Token.Kind() is SyntaxKind.Utf8SingleLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 7618if (node.Kind() == SyntaxKind.SimpleMemberAccessExpression) 7625Debug.Assert(node.Kind() == SyntaxKind.PointerMemberAccessExpression); 7679Debug.Assert((left.Parent is MemberAccessExpressionSyntax { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression } memberAccess && memberAccess.Expression == left) || 7807SeparatedSyntaxList<TypeSyntax> typeArgumentsSyntax = right.Kind() == SyntaxKind.GenericName ? 7838if (!hasErrors && typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument)) 7936var typeArgumentsSyntax = right.Kind() == SyntaxKind.GenericName ? ((GenericNameSyntax)right).TypeArgumentList.Arguments : default(SeparatedSyntaxList<TypeSyntax>); 8372if (!boundMethodGroup.HasErrors && typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument)) 8438(node.Kind() == SyntaxKind.AwaitExpression && plainName == WellKnownMemberNames.GetResult) || 10459var name = candidate.IsIndexer ? SyntaxFacts.GetText(SyntaxKind.ThisKeyword) : candidate.Name; 11713case SyntaxKind.ExpressionStatement: 11717case SyntaxKind.SimpleLambdaExpression: 11721case SyntaxKind.ParenthesizedLambdaExpression: 11725case SyntaxKind.ArrowExpressionClause: 11729case SyntaxKind.ForStatement: 11778while (receiver.IsKind(SyntaxKind.ParenthesizedExpression))
Binder\Binder_Flags.cs (1)
112return !withoutUnsafe && modifiers.Any(SyntaxKind.UnsafeKeyword) && (isFieldDeclaration || !this.Compilation.SourceModule.UseUpdatedMemorySafetyRules)
Binder\Binder_InterpolatedString.cs (7)
25if (node.StringStartToken.Kind() is SyntaxKind.InterpolatedSingleLineRawStringStartToken or SyntaxKind.InterpolatedMultiLineRawStringStartToken) 51var isNonVerbatimInterpolatedString = node.StringStartToken.Kind() != SyntaxKind.InterpolatedVerbatimStringStartToken; 52var isRawInterpolatedString = node.StringStartToken.Kind() is SyntaxKind.InterpolatedSingleLineRawStringStartToken or SyntaxKind.InterpolatedMultiLineRawStringStartToken; 60case SyntaxKind.Interpolation: 154case SyntaxKind.InterpolatedStringText:
Binder\Binder_Invocation.cs (22)
29case SyntaxKind.IdentifierName: 30case SyntaxKind.GenericName: 32case SyntaxKind.SimpleMemberAccessExpression: 33case SyntaxKind.PointerMemberAccessExpression: 35case SyntaxKind.ParenthesizedExpression: 194bool isArglist = node.Expression.Kind() == SyntaxKind.ArgListExpression; 226Debug.Assert(node.Expression.Kind() is SyntaxKind.SimpleMemberAccessExpression); 254if (node.Expression is MemberAccessExpressionSyntax { Expression: InvocationExpressionSyntax receiver, RawKind: (int)SyntaxKind.SimpleMemberAccessExpression } && !receiver.MayBeNameofOperator()) 1357WarnOnAccessOfOffDefault(node.Kind() == SyntaxKind.InvocationExpression ? 1935case SyntaxKind.QualifiedName: 1938case SyntaxKind.SimpleMemberAccessExpression: 1939case SyntaxKind.PointerMemberAccessExpression: 2461case SyntaxKind.IdentifierName: 2467case SyntaxKind.GenericName: 2473case SyntaxKind.SimpleMemberAccessExpression: 2479case SyntaxKind.BaseExpression: 2480case SyntaxKind.ThisExpression: 2489case SyntaxKind.AliasQualifiedName: 2501case SyntaxKind.ThisExpression: 2502case SyntaxKind.BaseExpression: 2503case SyntaxKind.PredefinedType: 2525this.LookupSymbolsWithFallback(lookupResult, SyntaxFacts.GetText(SyntaxKind.NameOfKeyword), useSiteInfo: ref discardedUseSiteInfo, arity: 0, options: options);
Binder\Binder_Lambda.cs (12)
71case SyntaxKind.SimpleLambdaExpression: 78case SyntaxKind.ParenthesizedLambdaExpression: 91case SyntaxKind.AnonymousMethodExpression: 111if (modifier.IsKind(SyntaxKind.AsyncKeyword)) 116else if (modifier.IsKind(SyntaxKind.StaticKeyword)) 125var isAnonymousMethod = syntax.IsKind(SyntaxKind.AnonymousMethodExpression); 183var isParams = paramsKeyword.Kind() != SyntaxKind.None; 192paramsKeyword.Kind() != SyntaxKind.None && 208attributesBuilder.Add(syntax.Kind() == SyntaxKind.ParenthesizedLambdaExpression ? p.AttributeLists : default); 279if (syntax.Kind() == SyntaxKind.ParenthesizedLambdaExpression) 285Error(diagnostics, syntax.Kind() == SyntaxKind.SimpleLambdaExpression ? ErrorCode.ERR_AttributesRequireParenthesizedLambdaExpression : ErrorCode.ERR_AttributesNotAllowed, attributeList); 298if (syntax is IdentifierNameSyntax { Identifier.RawContextualKind: (int)SyntaxKind.VarKeyword })
Binder\Binder_Operators.cs (99)
856protected static bool IsSimpleBinaryOperator(SyntaxKind kind) 861case SyntaxKind.AddExpression: 862case SyntaxKind.MultiplyExpression: 863case SyntaxKind.SubtractExpression: 864case SyntaxKind.DivideExpression: 865case SyntaxKind.ModuloExpression: 866case SyntaxKind.EqualsExpression: 867case SyntaxKind.NotEqualsExpression: 868case SyntaxKind.GreaterThanExpression: 869case SyntaxKind.LessThanExpression: 870case SyntaxKind.GreaterThanOrEqualExpression: 871case SyntaxKind.LessThanOrEqualExpression: 872case SyntaxKind.BitwiseAndExpression: 873case SyntaxKind.BitwiseOrExpression: 874case SyntaxKind.ExclusiveOrExpression: 875case SyntaxKind.LeftShiftExpression: 876case SyntaxKind.RightShiftExpression: 877case SyntaxKind.UnsignedRightShiftExpression: 908&& !parenthesizedExpression.Expression.IsKind(SyntaxKind.ParenthesizedExpression)) 914if (parenthesizedExpression.Expression.IsKind(SyntaxKind.IdentifierName) 1030case SyntaxKind.EqualsExpression: 1031case SyntaxKind.NotEqualsExpression: 1032case SyntaxKind.LessThanExpression: 1033case SyntaxKind.LessThanOrEqualExpression: 1034case SyntaxKind.GreaterThanExpression: 1035case SyntaxKind.GreaterThanOrEqualExpression: 1308node.OperatorToken.RawKind is (int)SyntaxKind.PlusEqualsToken or (int)SyntaxKind.MinusEqualsToken && 1332bool isEquality = operatorToken.Kind() == SyntaxKind.EqualsEqualsToken || operatorToken.Kind() == SyntaxKind.ExclamationEqualsToken; 1367case LookupResultKind.OverloadResolutionFailure when operatorToken.Kind() is SyntaxKind.PlusToken && isReadOnlySpanOfByte(left.Type) && isReadOnlySpanOfByte(right.Type): 1389Debug.Assert(node.Kind() == SyntaxKind.LogicalOrExpression || node.Kind() == SyntaxKind.LogicalAndExpression); 1402(childAsBinary.Kind() != SyntaxKind.LogicalOrExpression && childAsBinary.Kind() != SyntaxKind.LogicalAndExpression)) 3216public static BinaryOperatorKind SyntaxKindToBinaryOperatorKind(SyntaxKind kind) 3220case SyntaxKind.MultiplyAssignmentExpression: 3221case SyntaxKind.MultiplyExpression: return BinaryOperatorKind.Multiplication; 3222case SyntaxKind.DivideAssignmentExpression: 3223case SyntaxKind.DivideExpression: return BinaryOperatorKind.Division; 3224case SyntaxKind.ModuloAssignmentExpression: 3225case SyntaxKind.ModuloExpression: return BinaryOperatorKind.Remainder; 3226case SyntaxKind.AddAssignmentExpression: 3227case SyntaxKind.AddExpression: return BinaryOperatorKind.Addition; 3228case SyntaxKind.SubtractAssignmentExpression: 3229case SyntaxKind.SubtractExpression: return BinaryOperatorKind.Subtraction; 3230case SyntaxKind.RightShiftAssignmentExpression: 3231case SyntaxKind.RightShiftExpression: return BinaryOperatorKind.RightShift; 3232case SyntaxKind.UnsignedRightShiftAssignmentExpression: 3233case SyntaxKind.UnsignedRightShiftExpression: return BinaryOperatorKind.UnsignedRightShift; 3234case SyntaxKind.LeftShiftAssignmentExpression: 3235case SyntaxKind.LeftShiftExpression: return BinaryOperatorKind.LeftShift; 3236case SyntaxKind.EqualsExpression: return BinaryOperatorKind.Equal; 3237case SyntaxKind.NotEqualsExpression: return BinaryOperatorKind.NotEqual; 3238case SyntaxKind.GreaterThanExpression: return BinaryOperatorKind.GreaterThan; 3239case SyntaxKind.LessThanExpression: return BinaryOperatorKind.LessThan; 3240case SyntaxKind.GreaterThanOrEqualExpression: return BinaryOperatorKind.GreaterThanOrEqual; 3241case SyntaxKind.LessThanOrEqualExpression: return BinaryOperatorKind.LessThanOrEqual; 3242case SyntaxKind.AndAssignmentExpression: 3243case SyntaxKind.BitwiseAndExpression: return BinaryOperatorKind.And; 3244case SyntaxKind.OrAssignmentExpression: 3245case SyntaxKind.BitwiseOrExpression: return BinaryOperatorKind.Or; 3246case SyntaxKind.ExclusiveOrAssignmentExpression: 3247case SyntaxKind.ExclusiveOrExpression: return BinaryOperatorKind.Xor; 3248case SyntaxKind.LogicalAndExpression: return BinaryOperatorKind.LogicalAnd; 3249case SyntaxKind.LogicalOrExpression: return BinaryOperatorKind.LogicalOr; 4069Debug.Assert(node.Operand.SkipParens().GetLastToken().Kind() == SyntaxKind.ExclamationToken); 4636public static UnaryOperatorKind SyntaxKindToUnaryOperatorKind(SyntaxKind kind) 4640case SyntaxKind.PreIncrementExpression: return UnaryOperatorKind.PrefixIncrement; 4641case SyntaxKind.PostIncrementExpression: return UnaryOperatorKind.PostfixIncrement; 4642case SyntaxKind.PreDecrementExpression: return UnaryOperatorKind.PrefixDecrement; 4643case SyntaxKind.PostDecrementExpression: return UnaryOperatorKind.PostfixDecrement; 4644case SyntaxKind.UnaryPlusExpression: return UnaryOperatorKind.UnaryPlus; 4645case SyntaxKind.UnaryMinusExpression: return UnaryOperatorKind.UnaryMinus; 4646case SyntaxKind.LogicalNotExpression: return UnaryOperatorKind.LogicalNegation; 4647case SyntaxKind.BitwiseNotExpression: return UnaryOperatorKind.BitwiseComplement; 4652private static BindValueKind GetBinaryAssignmentKind(SyntaxKind kind) 4656case SyntaxKind.SimpleAssignmentExpression: 4658case SyntaxKind.AddAssignmentExpression: 4659case SyntaxKind.AndAssignmentExpression: 4660case SyntaxKind.DivideAssignmentExpression: 4661case SyntaxKind.ExclusiveOrAssignmentExpression: 4662case SyntaxKind.LeftShiftAssignmentExpression: 4663case SyntaxKind.ModuloAssignmentExpression: 4664case SyntaxKind.MultiplyAssignmentExpression: 4665case SyntaxKind.OrAssignmentExpression: 4666case SyntaxKind.RightShiftAssignmentExpression: 4667case SyntaxKind.UnsignedRightShiftAssignmentExpression: 4668case SyntaxKind.SubtractAssignmentExpression: 4669case SyntaxKind.CoalesceAssignmentExpression: 4676private static BindValueKind GetUnaryAssignmentKind(SyntaxKind kind) 4680case SyntaxKind.PreDecrementExpression: 4681case SyntaxKind.PreIncrementExpression: 4682case SyntaxKind.PostDecrementExpression: 4683case SyntaxKind.PostIncrementExpression: 4685case SyntaxKind.AddressOfExpression: 4707if (node.Kind() != SyntaxKind.UnaryMinusExpression) 4712if (node.Operand != operand.Syntax || operand.Syntax.Kind() != SyntaxKind.NumericLiteralExpression) 4805Error(diagnostics, ErrorCode.ERR_BadUnaryOp, node, SyntaxFacts.GetText(SyntaxKind.IsKeyword), operand.Display);
Binder\Binder_Patterns.cs (17)
968case SyntaxKind.DefaultLiteralExpression: 972case SyntaxKind.ParenthesizedExpression: 975case SyntaxKind.SuppressNullableWarningExpression: 1836if (node.Designation?.Kind() == SyntaxKind.SingleVariableDesignation) 1941if ((inputType.IsPointerOrFunctionPointer() && node.Designation.Kind() == SyntaxKind.ParenthesizedVariableDesignation) 1971case SyntaxKind.DiscardDesignation: 1976case SyntaxKind.SingleVariableDesignation: 1989node.Parent.Kind() == SyntaxKind.VarPattern ? node.Parent : node, // for `var x` use whole pattern, otherwise use designation for the syntax 1993case SyntaxKind.ParenthesizedVariableDesignation: 2194case MemberAccessExpressionSyntax { Name: IdentifierNameSyntax name } memberAccess when memberAccess.IsKind(SyntaxKind.SimpleMemberAccessExpression): 2364static BinaryOperatorKind tokenKindToBinaryOperatorKind(SyntaxKind kind) => kind switch 2366SyntaxKind.LessThanEqualsToken => BinaryOperatorKind.LessThanOrEqual, 2367SyntaxKind.LessThanToken => BinaryOperatorKind.LessThan, 2368SyntaxKind.GreaterThanToken => BinaryOperatorKind.GreaterThan, 2369SyntaxKind.GreaterThanEqualsToken => BinaryOperatorKind.GreaterThanOrEqual, 2449permitDesignations = permitDesignations && currentNode.IsKind(SyntaxKind.AndPattern); 2496bool 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 (84)
47if (node.Kind() == SyntaxKind.LocalFunctionStatement) 51else if (node.Kind() != SyntaxKind.Block) 63case SyntaxKind.Block: 66case SyntaxKind.LocalDeclarationStatement: 69case SyntaxKind.LocalFunctionStatement: 72case SyntaxKind.ExpressionStatement: 75case SyntaxKind.IfStatement: 78case SyntaxKind.SwitchStatement: 81case SyntaxKind.DoStatement: 84case SyntaxKind.WhileStatement: 87case SyntaxKind.ForStatement: 90case SyntaxKind.ForEachStatement: 91case SyntaxKind.ForEachVariableStatement: 94case SyntaxKind.BreakStatement: 97case SyntaxKind.ContinueStatement: 100case SyntaxKind.ReturnStatement: 103case SyntaxKind.FixedStatement: 106case SyntaxKind.LabeledStatement: 109case SyntaxKind.GotoStatement: 110case SyntaxKind.GotoCaseStatement: 111case SyntaxKind.GotoDefaultStatement: 114case SyntaxKind.TryStatement: 117case SyntaxKind.EmptyStatement: 120case SyntaxKind.ThrowStatement: 123case SyntaxKind.UnsafeStatement: 126case SyntaxKind.UncheckedStatement: 127case SyntaxKind.CheckedStatement: 130case SyntaxKind.UsingStatement: 133case SyntaxKind.YieldBreakStatement: 136case SyntaxKind.YieldReturnStatement: 139case SyntaxKind.LockStatement: 325case SyntaxKind.LocalDeclarationStatement: 330goto case SyntaxKind.ExpressionStatement; 332case SyntaxKind.ExpressionStatement: 333case SyntaxKind.LockStatement: 334case SyntaxKind.IfStatement: 335case SyntaxKind.YieldReturnStatement: 336case SyntaxKind.ReturnStatement: 337case SyntaxKind.ThrowStatement: 342case SyntaxKind.LabeledStatement: 343case SyntaxKind.LocalFunctionStatement: 351case SyntaxKind.SwitchStatement: 357case SyntaxKind.EmptyStatement: 363case SyntaxKind.ForStatement: 364case SyntaxKind.ForEachStatement: 365case SyntaxKind.ForEachVariableStatement: 366case SyntaxKind.WhileStatement: 370if (emptyStatement.SemicolonToken.GetNextToken().Kind() != SyntaxKind.OpenBraceToken) 514case SyntaxKind.GotoStatement: 525case SyntaxKind.GotoCaseStatement: 526case SyntaxKind.GotoDefaultStatement: 602if (modifier.IsKind(SyntaxKind.StaticKeyword)) 604else if (modifier.IsKind(SyntaxKind.ExternKeyword)) 795declarationNode.Kind() == SyntaxKind.VariableDeclaration || 796declarationNode.Kind() == SyntaxKind.DeclarationExpression || 797declarationNode.Kind() == SyntaxKind.DiscardDesignation); 835if (declarationNode.Parent.Kind() == SyntaxKind.LocalDeclarationStatement && 890if (initializer.Kind() == SyntaxKind.ArrayInitializerExpression) 1416if (node.Left.Kind() == SyntaxKind.TupleExpression || node.Left.Kind() == SyntaxKind.DeclarationExpression) 1722case SyntaxKind.SimpleMemberAccessExpression: 1723case SyntaxKind.PointerMemberAccessExpression: 1726case SyntaxKind.IdentifierName: 1729case SyntaxKind.ElementAccessExpression: 1771case SyntaxKind.SimpleMemberAccessExpression: 1772case SyntaxKind.PointerMemberAccessExpression: 1774case SyntaxKind.QualifiedName: 1777case SyntaxKind.IdentifierName: 1779case SyntaxKind.MemberBindingExpression: 1873if (node.Kind() != SyntaxKind.ArrayInitializerExpression) 1945hasUnsafeModifier: node.Parent?.Kind() == SyntaxKind.UnsafeStatement, 2290if (sourceType.SpecialType == SpecialType.System_Double && syntax.Kind() == SyntaxKind.NumericLiteralExpression && 2493while (nodeForError.Kind() == SyntaxKind.ParenthesizedExpression) 2498if (nodeForError.Kind() == SyntaxKind.SimpleMemberAccessExpression || nodeForError.Kind() == SyntaxKind.PointerMemberAccessExpression) 3599return new BoundBlock(node, locals, ImmutableArray.Create(statement)) { WasCompilerGenerated = node.Kind() != SyntaxKind.ArrowExpressionClause }; 3604return IsValidStatementExpression(expressionSyntax, expression) || expressionSyntax.Kind() == SyntaxKind.ThrowExpression; 3668Debug.Assert(body.Kind() != SyntaxKind.RefExpression); 3694if (method.Kind() == SyntaxKind.ConstructorDeclaration) 3747Debug.Assert(typeDecl.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.StructDeclaration); 3790bool thisInitializer = initializer?.IsKind(SyntaxKind.ThisConstructorInitializer) == true;
Binder\Binder_Symbols.cs (26)
367if (node.Identifier.Kind() == SyntaxKind.GlobalKeyword) 424case SyntaxKind.NullableType: 427case SyntaxKind.PredefinedType: 430case SyntaxKind.IdentifierName: 433case SyntaxKind.GenericName: 436case SyntaxKind.AliasQualifiedName: 439case SyntaxKind.QualifiedName: 445case SyntaxKind.SimpleMemberAccessExpression: 451case SyntaxKind.ArrayType: 456case SyntaxKind.PointerType: 459case SyntaxKind.FunctionPointerType: 479case SyntaxKind.OmittedTypeArgument: 484case SyntaxKind.TupleType: 490case SyntaxKind.RefType: 512case SyntaxKind.ScopedType: 674if (!permitDimensions && dimension.Count != 0 && dimension[0].Kind() != SyntaxKind.OmittedArraySizeExpression) 711if (nameToken.Kind() == SyntaxKind.IdentifierToken) 848case SyntaxKind.IdentifierName: 851case SyntaxKind.GenericName: 950if (node.Parent.Kind() == SyntaxKind.Attribute) 1029(invocation.Expression as IdentifierNameSyntax)?.Identifier.ContextualKind() == SyntaxKind.NameOfKeyword): 1385var arg = typeArgument.Kind() == SyntaxKind.OmittedTypeArgument 1397if (typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument)) 1450if (!hasErrors && lookupResult.IsMultiViable && typeArgumentsSyntax.Any(SyntaxKind.OmittedTypeArgument)) 2392if (node.Kind() == SyntaxKind.AliasQualifiedName) 2667Debug.Assert(aliasOpt == null || aliasOpt == SyntaxFacts.GetText(SyntaxKind.GlobalKeyword));
Binder\Binder_Unsafe.cs (1)
175Debug.Assert((node.Kind() == SyntaxKind.SizeOfExpression) == ((object?)sizeOfTypeOpt != null), "Should have a type for (only) sizeof expressions.");
Binder\BinderFactory.BinderFactoryVisitor.cs (36)
286case SyntaxKind.PropertyDeclaration: 287case SyntaxKind.IndexerDeclaration: 292accessor = (parent.Kind() == SyntaxKind.GetAccessorDeclaration) ? propertySymbol.GetMethod : propertySymbol.SetMethod; 297case SyntaxKind.EventDeclaration: 298case SyntaxKind.EventFieldDeclaration: 306accessor = (parent.Kind() == SyntaxKind.AddAccessorDeclaration) ? eventSymbol.AddMethod : eventSymbol.RemoveMethod; 441if (node.Parent.Kind() == SyntaxKind.CompilationUnit && syntaxTree.Options.Kind != SourceCodeKind.Regular) 463case SyntaxKind.ConstructorDeclaration: 464return (baseMethodDeclarationSyntax.Modifiers.Any(SyntaxKind.StaticKeyword) ? WellKnownMemberNames.StaticConstructorName : WellKnownMemberNames.InstanceConstructorName); 465case SyntaxKind.DestructorDeclaration: 467case SyntaxKind.OperatorDeclaration: 470case SyntaxKind.ConversionOperatorDeclaration: 473case SyntaxKind.MethodDeclaration: 492case SyntaxKind.PropertyDeclaration: 495case SyntaxKind.IndexerDeclaration: 497case SyntaxKind.EventDeclaration: 498case SyntaxKind.EventFieldDeclaration: 526Debug.Assert(basePropertyDeclarationSyntax.Kind() == SyntaxKind.PropertyDeclaration || basePropertyDeclarationSyntax.Kind() == SyntaxKind.IndexerDeclaration); 701var container = ((NamespaceOrTypeSymbol)outer.ContainingMemberOrLambda).GetSourceTypeMember(parent.Identifier.ValueText, 0, SyntaxKind.EnumDeclaration, parent); 865if (InScript && container.Kind() == SyntaxKind.CompilationUnit) 1035Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 1068if (containingNode.Kind() != SyntaxKind.CompilationUnit && _position == containingSpan.End) 1090if (node.IsKind(SyntaxKind.UsingDirective) && node.Parent == containingNode) 1282SyntaxKind memberKind = memberSyntax.Kind(); 1283if (memberKind == SyntaxKind.PropertyDeclaration || memberKind == SyntaxKind.IndexerDeclaration) 1312else if (memberKind == SyntaxKind.DelegateDeclaration) 1358if (memberSyntax.Kind() == SyntaxKind.MethodDeclaration) 1368else if (memberSyntax.Kind() == SyntaxKind.DelegateDeclaration) 1411if (baseTypeDeclaration is TypeDeclarationSyntax { SemicolonToken: { RawKind: (int)SyntaxKind.SemicolonToken }, OpenBraceToken: { RawKind: (int)SyntaxKind.None } } noBlockBodyTypeDeclarationWithSemicolon) 1443Debug.Assert(xmlSyntax is XmlAttributeSyntax || xmlSyntax.Kind() == SyntaxKind.XmlEmptyElement || xmlSyntax.Kind() == SyntaxKind.XmlElementStartTag);
Binder\BinderFactory.cs (4)
116if ((!InScript || node.Kind() != SyntaxKind.CompilationUnit) && node.Parent != null) 188case SyntaxKind.NamespaceDeclaration: 189case SyntaxKind.FileScopedNamespaceDeclaration: 197case SyntaxKind.CompilationUnit:
Binder\CatchClauseBinder.cs (1)
32if ((declarationOpt != null) && (declarationOpt.Identifier.Kind() != SyntaxKind.None))
Binder\DecisionDagBuilder.cs (2)
155if (label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 3487if (e.Syntax.IsKind(SyntaxKind.ListPattern))
Binder\DecisionDagBuilder_CheckOrReachability.cs (3)
178if (label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 195if (label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 284return syntax.Kind() == SyntaxKind.NotPattern;
Binder\EarlyWellKnownAttributeBinder.cs (48)
63case SyntaxKind.ObjectCreationExpression: 64case SyntaxKind.ImplicitObjectCreationExpression: 71case SyntaxKind.SizeOfExpression: 74case SyntaxKind.TypeOfExpression: 81case SyntaxKind.NumericLiteralExpression: 82case SyntaxKind.StringLiteralExpression: 83case SyntaxKind.Utf8StringLiteralExpression: 84case SyntaxKind.InterpolatedStringExpression: 85case SyntaxKind.CharacterLiteralExpression: 86case SyntaxKind.TrueLiteralExpression: 87case SyntaxKind.FalseLiteralExpression: 88case SyntaxKind.NullLiteralExpression: 92case SyntaxKind.IdentifierName: 93case SyntaxKind.GenericName: 94case SyntaxKind.AliasQualifiedName: 95case SyntaxKind.QualifiedName: 96case SyntaxKind.PredefinedType: 97case SyntaxKind.SimpleMemberAccessExpression: 102case SyntaxKind.ParenthesizedExpression: 105case SyntaxKind.CastExpression: 108case SyntaxKind.UncheckedExpression: 109case SyntaxKind.CheckedExpression: 112case SyntaxKind.DefaultExpression: 115case SyntaxKind.UnaryPlusExpression: 116case SyntaxKind.UnaryMinusExpression: 117case SyntaxKind.LogicalNotExpression: 118case SyntaxKind.BitwiseNotExpression: 121case SyntaxKind.AddExpression: 122case SyntaxKind.MultiplyExpression: 123case SyntaxKind.SubtractExpression: 124case SyntaxKind.DivideExpression: 125case SyntaxKind.ModuloExpression: 126case SyntaxKind.LeftShiftExpression: 127case SyntaxKind.RightShiftExpression: 128case SyntaxKind.UnsignedRightShiftExpression: 129case SyntaxKind.BitwiseAndExpression: 130case SyntaxKind.BitwiseOrExpression: 131case SyntaxKind.ExclusiveOrExpression: 132case SyntaxKind.LogicalAndExpression: 133case SyntaxKind.LogicalOrExpression: 134case SyntaxKind.EqualsExpression: 135case SyntaxKind.NotEqualsExpression: 136case SyntaxKind.GreaterThanExpression: 137case SyntaxKind.LessThanExpression: 138case SyntaxKind.GreaterThanOrEqualExpression: 139case SyntaxKind.LessThanOrEqualExpression: 140case SyntaxKind.InvocationExpression: // To support nameof(); anything else will be a compile-time error 141case SyntaxKind.ConditionalExpression: // The ?: conditional operator.
Binder\ExpressionVariableFinder.cs (34)
37case SyntaxKind.EqualsValueClause: 38case SyntaxKind.ArrowExpressionClause: 39case SyntaxKind.SwitchSection: 40case SyntaxKind.Attribute: 41case SyntaxKind.ThrowStatement: 42case SyntaxKind.ReturnStatement: 43case SyntaxKind.YieldReturnStatement: 44case SyntaxKind.ExpressionStatement: 45case SyntaxKind.LockStatement: 46case SyntaxKind.IfStatement: 47case SyntaxKind.SwitchStatement: 48case SyntaxKind.VariableDeclarator: 49case SyntaxKind.ConstructorDeclaration: 50case SyntaxKind.SwitchExpressionArm: 51case SyntaxKind.GotoCaseStatement: 52case SyntaxKind.PrimaryConstructorBaseType: 54case SyntaxKind.ArgumentList: 99if (node.Kind() == SyntaxKind.GotoCaseStatement) 143case SyntaxKind.CasePatternSwitchLabel: 157case SyntaxKind.CaseSwitchLabel: 215if (node.Designation?.Kind() == SyntaxKind.SingleVariableDesignation) 226Debug.Assert(node.Designation == null || node.Designation.Kind() == SyntaxKind.DiscardDesignation); 242case SyntaxKind.SingleVariableDesignation: 249case SyntaxKind.DiscardDesignation: 251case SyntaxKind.ParenthesizedVariableDesignation: 307if (clause.Kind() == SyntaxKind.JoinClause) 419case SyntaxKind.SingleVariableDesignation: 427case SyntaxKind.DiscardDesignation: 430case SyntaxKind.ParenthesizedVariableDesignation: 472case SyntaxKind.TupleExpression: 481case SyntaxKind.DeclarationExpression: 502case SyntaxKind.SingleVariableDesignation: 512case SyntaxKind.ParenthesizedVariableDesignation: 521case SyntaxKind.DiscardDesignation:
Binder\FixedStatementBinder.cs (1)
39if (size.Kind() != SyntaxKind.OmittedArraySizeExpression)
Binder\ForEachLoopBinder.cs (11)
33return (_syntax.Kind() == SyntaxKind.ForEachStatement) ? (SourceLocalSymbol)this.Locals[0] : null; 74case SyntaxKind.ForEachVariableStatement: 85case SyntaxKind.ForEachStatement: 110case SyntaxKind.TupleExpression: 119case SyntaxKind.DeclarationExpression: 128case SyntaxKind.IdentifierName: 147case SyntaxKind.SingleVariableDesignation: 161case SyntaxKind.ParenthesizedVariableDesignation: 170case SyntaxKind.DiscardDesignation: 280case SyntaxKind.ForEachStatement: 377case SyntaxKind.ForEachVariableStatement:
Binder\ForLoopBinder.cs (1)
39if (size.Kind() != SyntaxKind.OmittedArraySizeExpression)
Binder\LocalBinderFactory.cs (21)
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) 672Binder binder = _enclosing.WithCheckedOrUncheckedRegion(@checked: node.Kind() == SyntaxKind.CheckedExpression); 679Binder binder = _enclosing.WithCheckedOrUncheckedRegion(@checked: node.Kind() == SyntaxKind.CheckedStatement); 753case SyntaxKind.CasePatternSwitchLabel: 763case SyntaxKind.CaseSwitchLabel: 1040case SyntaxKind.LocalDeclarationStatement: 1041case SyntaxKind.LabeledStatement: 1042case SyntaxKind.LocalFunctionStatement: 1046case SyntaxKind.ExpressionStatement: 1047case SyntaxKind.LockStatement: 1048case SyntaxKind.IfStatement: 1049case SyntaxKind.YieldReturnStatement: 1050case SyntaxKind.ReturnStatement: 1051case SyntaxKind.ThrowStatement: 1056case SyntaxKind.SwitchStatement: 1105if (clause.Kind() == SyntaxKind.JoinClause)
Binder\LocalScopeBinder.cs (15)
179while (innerStatement.Kind() == SyntaxKind.LabeledStatement) 186case SyntaxKind.LocalDeclarationStatement: 225case SyntaxKind.LocalFunctionStatement: 260case SyntaxKind.ExpressionStatement: 261case SyntaxKind.IfStatement: 262case SyntaxKind.YieldReturnStatement: 263case SyntaxKind.ReturnStatement: 264case SyntaxKind.ThrowStatement: 265case SyntaxKind.GotoCaseStatement: 269case SyntaxKind.SwitchStatement: 274case SyntaxKind.LockStatement: 289if (expression.Kind() != SyntaxKind.OmittedArraySizeExpression) 313while (innerStatement.Kind() == SyntaxKind.LabeledStatement) 318if (innerStatement.Kind() == SyntaxKind.LocalFunctionStatement) 364while (statement.Kind() == SyntaxKind.LabeledStatement)
Binder\LockOrUsingBinder.cs (3)
44Debug.Assert(targetExpressionSyntax.Parent.Kind() == SyntaxKind.LockStatement || 45targetExpressionSyntax.Parent.Kind() == SyntaxKind.UsingStatement); 54if (targetExpressionSyntax.Kind() == SyntaxKind.IdentifierName)
Binder\ScriptLocalScopeBinder.cs (1)
84if (member.Kind() != SyntaxKind.GlobalStatement)
Binder\Semantics\Conversions\ConversionsBase.cs (3)
1624if (anonymousFunction.Syntax.Kind() == SyntaxKind.AnonymousMethodExpression) 1768var greenNode = new Syntax.InternalSyntax.LiteralExpressionSyntax(SyntaxKind.NumericLiteralExpression, new Syntax.InternalSyntax.SyntaxToken(SyntaxKind.NumericLiteralToken));
Binder\Semantics\Operators\OperatorFacts.cs (50)
63public static string BinaryOperatorNameFromSyntaxKind(SyntaxKind kind, bool isChecked) 69internal static string BinaryOperatorNameFromSyntaxKindIfAny(SyntaxKind kind, bool isChecked) 73case SyntaxKind.PlusToken: return isChecked ? WellKnownMemberNames.CheckedAdditionOperatorName : WellKnownMemberNames.AdditionOperatorName; 74case SyntaxKind.MinusToken: return isChecked ? WellKnownMemberNames.CheckedSubtractionOperatorName : WellKnownMemberNames.SubtractionOperatorName; 75case SyntaxKind.AsteriskToken: return isChecked ? WellKnownMemberNames.CheckedMultiplyOperatorName : WellKnownMemberNames.MultiplyOperatorName; 76case SyntaxKind.SlashToken: return isChecked ? WellKnownMemberNames.CheckedDivisionOperatorName : WellKnownMemberNames.DivisionOperatorName; 77case SyntaxKind.PercentToken: return WellKnownMemberNames.ModulusOperatorName; 78case SyntaxKind.CaretToken: return WellKnownMemberNames.ExclusiveOrOperatorName; 79case SyntaxKind.AmpersandToken: return WellKnownMemberNames.BitwiseAndOperatorName; 80case SyntaxKind.BarToken: return WellKnownMemberNames.BitwiseOrOperatorName; 81case SyntaxKind.EqualsEqualsToken: return WellKnownMemberNames.EqualityOperatorName; 82case SyntaxKind.LessThanToken: return WellKnownMemberNames.LessThanOperatorName; 83case SyntaxKind.LessThanEqualsToken: return WellKnownMemberNames.LessThanOrEqualOperatorName; 84case SyntaxKind.LessThanLessThanToken: return WellKnownMemberNames.LeftShiftOperatorName; 85case SyntaxKind.GreaterThanToken: return WellKnownMemberNames.GreaterThanOperatorName; 86case SyntaxKind.GreaterThanEqualsToken: return WellKnownMemberNames.GreaterThanOrEqualOperatorName; 87case SyntaxKind.GreaterThanGreaterThanToken: return WellKnownMemberNames.RightShiftOperatorName; 88case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: return WellKnownMemberNames.UnsignedRightShiftOperatorName; 89case SyntaxKind.ExclamationEqualsToken: return WellKnownMemberNames.InequalityOperatorName; 95internal static string CompoundAssignmentOperatorNameFromSyntaxKind(SyntaxKind kind, bool isChecked) 99case SyntaxKind.PlusEqualsToken: return isChecked ? WellKnownMemberNames.CheckedAdditionAssignmentOperatorName : WellKnownMemberNames.AdditionAssignmentOperatorName; 100case SyntaxKind.MinusEqualsToken: return isChecked ? WellKnownMemberNames.CheckedSubtractionAssignmentOperatorName : WellKnownMemberNames.SubtractionAssignmentOperatorName; 101case SyntaxKind.AsteriskEqualsToken: return isChecked ? WellKnownMemberNames.CheckedMultiplicationAssignmentOperatorName : WellKnownMemberNames.MultiplicationAssignmentOperatorName; 102case SyntaxKind.SlashEqualsToken: return isChecked ? WellKnownMemberNames.CheckedDivisionAssignmentOperatorName : WellKnownMemberNames.DivisionAssignmentOperatorName; 103case SyntaxKind.PercentEqualsToken: return WellKnownMemberNames.ModulusAssignmentOperatorName; 104case SyntaxKind.CaretEqualsToken: return WellKnownMemberNames.ExclusiveOrAssignmentOperatorName; 105case SyntaxKind.AmpersandEqualsToken: return WellKnownMemberNames.BitwiseAndAssignmentOperatorName; 106case SyntaxKind.BarEqualsToken: return WellKnownMemberNames.BitwiseOrAssignmentOperatorName; 107case SyntaxKind.LessThanLessThanEqualsToken: return WellKnownMemberNames.LeftShiftAssignmentOperatorName; 108case SyntaxKind.GreaterThanGreaterThanEqualsToken: return WellKnownMemberNames.RightShiftAssignmentOperatorName; 109case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: return WellKnownMemberNames.UnsignedRightShiftAssignmentOperatorName; 110case SyntaxKind.PlusPlusToken: return isChecked ? WellKnownMemberNames.CheckedIncrementAssignmentOperatorName : WellKnownMemberNames.IncrementAssignmentOperatorName; 111case SyntaxKind.MinusMinusToken: return isChecked ? WellKnownMemberNames.CheckedDecrementAssignmentOperatorName : WellKnownMemberNames.DecrementAssignmentOperatorName; 147public static string UnaryOperatorNameFromSyntaxKind(SyntaxKind kind, bool isChecked) 153internal static string UnaryOperatorNameFromSyntaxKindIfAny(SyntaxKind kind, bool isChecked) 157case SyntaxKind.PlusToken: return WellKnownMemberNames.UnaryPlusOperatorName; 158case SyntaxKind.MinusToken: return isChecked ? WellKnownMemberNames.CheckedUnaryNegationOperatorName : WellKnownMemberNames.UnaryNegationOperatorName; 159case SyntaxKind.TildeToken: return WellKnownMemberNames.OnesComplementOperatorName; 160case SyntaxKind.ExclamationToken: return WellKnownMemberNames.LogicalNotOperatorName; 161case SyntaxKind.PlusPlusToken: return isChecked ? WellKnownMemberNames.CheckedIncrementOperatorName : WellKnownMemberNames.IncrementOperatorName; 162case SyntaxKind.MinusMinusToken: return isChecked ? WellKnownMemberNames.CheckedDecrementOperatorName : WellKnownMemberNames.DecrementOperatorName; 163case SyntaxKind.TrueKeyword: return WellKnownMemberNames.TrueOperatorName; 164case SyntaxKind.FalseKeyword: return WellKnownMemberNames.FalseOperatorName; 177var opTokenKind = declaration.OperatorToken.Kind; 178bool isChecked = declaration.CheckedKeyword?.Kind == SyntaxKind.CheckedKeyword; 183if (opTokenKind != SyntaxKind.AsteriskToken && // IsPrefixUnaryExpressionOperatorToken treats it as pointer dereference operator 194if (opTokenKind is SyntaxKind.PlusPlusToken or SyntaxKind.MinusMinusToken && 222case SyntaxKind.ImplicitKeyword: 225return declaration.CheckedKeyword?.Kind == SyntaxKind.CheckedKeyword ?
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (2)
691else if (nodeOpt?.Kind() == SyntaxKind.AwaitExpression && symbol.Name == WellKnownMemberNames.GetAwaiter) 940badParamName = SyntaxFacts.GetText(SyntaxKind.ArgListKeyword);
Binder\SwitchBinder.cs (10)
100SyntaxKind labelKind = label.IdentifierNodeOrToken.Kind(); 101if (labelKind == SyntaxKind.IdentifierToken) 113else if (labelKind == SyntaxKind.DefaultSwitchLabel) 208case SyntaxKind.CaseSwitchLabel: 223case SyntaxKind.CasePatternSwitchLabel: 496Debug.Assert(node.Kind() == SyntaxKind.GotoCaseStatement || node.Kind() == SyntaxKind.GotoDefaultStatement); 516Debug.Assert(node.Kind() == SyntaxKind.GotoCaseStatement); 541Debug.Assert(node.Kind() == SyntaxKind.GotoDefaultStatement); 551if (node.Kind() == SyntaxKind.GotoCaseStatement)
Binder\SwitchBinder_Patterns.cs (4)
104if (!label.HasErrors && isSubsumed(label, reachableLabels) && label.Syntax.Kind() != SyntaxKind.DefaultSwitchLabel) 246case SyntaxKind.CaseSwitchLabel: 259case SyntaxKind.DefaultSwitchLabel: 277case SyntaxKind.CasePatternSwitchLabel:
Binder\UsingStatementBinder.cs (3)
49if (size.Kind() != SyntaxKind.OmittedArraySizeExpression) 92bool isUsingDeclaration = syntax.Kind() == SyntaxKind.LocalDeclarationStatement; 93bool isExpression = !isUsingDeclaration && syntax.Kind() != SyntaxKind.VariableDeclaration;
Binder\WhileBinder.cs (4)
24Debug.Assert(syntax != null && (syntax.IsKind(SyntaxKind.WhileStatement) || syntax.IsKind(SyntaxKind.DoStatement))); 55case SyntaxKind.WhileStatement: 58case SyntaxKind.DoStatement:
Binder\WithCrefTypeParametersBinder.cs (13)
50case SyntaxKind.TypeCref: 55case SyntaxKind.QualifiedCref: 62case SyntaxKind.NameMemberCref: 63case SyntaxKind.IndexerMemberCref: 64case SyntaxKind.OperatorMemberCref: 65case SyntaxKind.ConversionOperatorMemberCref: 66case SyntaxKind.ExtensionMemberCref: 83case SyntaxKind.AliasQualifiedName: 86case SyntaxKind.QualifiedName: 93case SyntaxKind.GenericName: 96case SyntaxKind.IdentifierName: 97case SyntaxKind.PredefinedType: 133if (typeArguments[i].Kind() == SyntaxKind.IdentifierName)
Binder\WithExternAliasesBinder.cs (3)
91Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration);
Binder\WithExternAndUsingAliasesBinder.cs (3)
120Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration);
Binder\WithUsingNamespacesAndTypesBinder.cs (5)
264Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 294Debug.Assert(declarationSyntax.IsKind(SyntaxKind.CompilationUnit) || declarationSyntax.IsKind(SyntaxKind.NamespaceDeclaration));
BoundTree\UnboundLambda.cs (7)
75public MessageID MessageID { get { return Syntax.Kind() == SyntaxKind.AnonymousMethodExpression ? MessageID.IDS_AnonMethod : MessageID.IDS_Lambda; } } 713else if (type.IsRefLikeOrAllowsRefLikeType() && ParameterSyntax(i)?.Modifiers.Any(SyntaxKind.ParamsKeyword) == true) 1561public override MessageID MessageID { get { return this.UnboundLambda.Syntax.Kind() == SyntaxKind.AnonymousMethodExpression ? MessageID.IDS_AnonMethod : MessageID.IDS_Lambda; } } 1578case SyntaxKind.SimpleLambdaExpression: 1580case SyntaxKind.ParenthesizedLambdaExpression: 1582case SyntaxKind.AnonymousMethodExpression: 1587private bool IsExpressionLambda { get { return Body.Kind() != SyntaxKind.Block; } }
BoundTree\VariablePendingInference.cs (6)
37Debug.Assert(this.Syntax.Kind() == SyntaxKind.SingleVariableDesignation || 38(this.Syntax.Kind() == SyntaxKind.DeclarationExpression && 39((DeclarationExpressionSyntax)this.Syntax).Designation.Kind() == SyntaxKind.SingleVariableDesignation)); 61SyntaxNode typeOrDesignationSyntax = this.Syntax.Kind() == SyntaxKind.DeclarationExpression ? 124case SyntaxKind.DeclarationExpression: 127case SyntaxKind.SingleVariableDesignation:
CodeGen\EmitStatement.cs (6)
812(local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchSection || local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchExpressionArm)); 857return _ilEmitStyle == ILEmitStyle.Debug && _method.GenerateDebugInfo && _methodBodySyntaxOpt?.IsKind(SyntaxKind.Block) == true || 868(boundReturnStatement.Syntax.IsKind(SyntaxKind.Block) || _method?.IsImplicitConstructor == true) && 1866(local.ScopeDesignatorOpt?.Kind() is SyntaxKind.SwitchSection or SyntaxKind.SwitchExpressionArm)))
CommandLine\CSharpCompiler.cs (1)
351d => d.IsActive && !d.HasErrors && d.Kind() == SyntaxKind.LineDirectiveTrivia))
Compilation\AttributeSemanticModel.cs (3)
65case SyntaxKind.Attribute: 68case SyntaxKind.AttributeArgument: 87if (node.Kind() == SyntaxKind.Attribute)
Compilation\CSharpCompilation.cs (16)
870if (root.DescendantNodes(n => n is GlobalStatementSyntax || n is StatementSyntax || n is CompilationUnitSyntax).Any(n => n.IsKind(SyntaxKind.ReturnStatement))) 876var lastGlobalStatement = (GlobalStatementSyntax?)root.Members.LastOrDefault(m => m.IsKind(SyntaxKind.GlobalStatement)); 880if (statement.IsKind(SyntaxKind.ExpressionStatement)) 2769ErrorCode code = info.Kind == SyntaxKind.ExternAliasDirective 2783else if (info.Kind == SyntaxKind.ExternAliasDirective) 2892public readonly SyntaxKind Kind; 2895public ImportInfo(SyntaxTree tree, SyntaxKind kind, TextSpan span) 4020var checksumDirectives = tree.GetRoot().GetDirectives(d => d.Kind() == SyntaxKind.PragmaChecksumDirectiveTrivia && 4451var syntaxKind = SyntaxFacts.GetOperatorKind(name); 4452if (syntaxKind == SyntaxKind.None) 4674var syntaxKind = SyntaxFacts.GetOperatorKind(name); 4678if (syntaxKind == SyntaxKind.None || name is WellKnownMemberNames.TrueOperatorName or WellKnownMemberNames.FalseOperatorName) 4967Func<SyntaxNode, SyntaxKind> getKind = node => node.Kind(); 4968Func<SyntaxTrivia, bool> isComment = trivia => trivia.Kind() == SyntaxKind.SingleLineCommentTrivia || trivia.Kind() == SyntaxKind.MultiLineCommentTrivia; 4969return new AnalyzerDriver<SyntaxKind>(analyzers, getKind, analyzerManager, severityFilter, isComment);
Compilation\CSharpSemanticModel.cs (64)
71case SyntaxKind.CollectionInitializerExpression: 72case SyntaxKind.ObjectInitializerExpression: 84case SyntaxKind.ComplexElementInitializerExpression: 92case SyntaxKind.IdentifierName: 94if (!isSpeculative && node.Parent != null && node.Parent.Kind() == SyntaxKind.NameEquals && node.Parent.Parent.Kind() == SyntaxKind.UsingDirective) 101case SyntaxKind.OmittedTypeArgument: 102case SyntaxKind.RefExpression: 103case SyntaxKind.RefType: 104case SyntaxKind.ScopedType: 305if (expression.IsKind(SyntaxKind.QualifiedName)) 347while (crefSyntax.Kind() == SyntaxKind.QualifiedCref) 354case SyntaxKind.NameMemberCref: 356case SyntaxKind.IndexerMemberCref: 358case SyntaxKind.OperatorMemberCref: 360case SyntaxKind.ConversionOperatorMemberCref: 362case SyntaxKind.ExtensionMemberCref: 540case SyntaxKind.SingleVariableDesignation: 543case SyntaxKind.DiscardDesignation: 546case SyntaxKind.ParenthesizedVariableDesignation: 563if (declaration.Designation.Kind() != SyntaxKind.SingleVariableDesignation) 616if (expression.Parent != null && expression.Parent.Kind() == SyntaxKind.CollectionInitializerExpression) 624initializer.Parent.Kind() == SyntaxKind.SimpleAssignmentExpression && 627initializer.Parent.Parent.Kind() == SyntaxKind.ObjectInitializerExpression) 978case SyntaxKind.SingleVariableDesignation: 984case SyntaxKind.DiscardDesignation: 988case SyntaxKind.ParenthesizedVariableDesignation: 1256if (node.Kind() == SyntaxKind.XmlCrefAttribute || node.Kind() == SyntaxKind.XmlNameAttribute) 1874if (curr.IsKind(SyntaxKind.TypeOfExpression)) 2410return parent.IsKind(SyntaxKind.GotoStatement) 2846if (expression.Kind() == SyntaxKind.DeclarationExpression) 3314Debug.Assert(catchClause.Kind() == SyntaxKind.CatchClause); 3382if (expr.Syntax.Kind() is SyntaxKind.ObjectCreationExpression or SyntaxKind.ImplicitObjectCreationExpression) 3409boundNodeForSyntacticParent.Syntax.Kind() == SyntaxKind.ObjectCreationExpression && 4001parentSyntax.Kind() == SyntaxKind.Attribute && ((AttributeSyntax)parentSyntax).Name == boundNode.Syntax) 4519if (parent3.IsKind(SyntaxKind.TupleExpression)) 4526if (parent3.IsKind(SyntaxKind.PropertyPatternClause) || parent3.IsKind(SyntaxKind.PositionalPatternClause)) 4894var kind = parentNode.Kind(); 4897case SyntaxKind.IfDirectiveTrivia: 4902case SyntaxKind.ElifDirectiveTrivia: 5155case SyntaxKind.LocalFunctionStatement: 5157case SyntaxKind.LabeledStatement: 5159case SyntaxKind.CaseSwitchLabel: 5160case SyntaxKind.DefaultSwitchLabel: 5162case SyntaxKind.AnonymousObjectCreationExpression: 5164case SyntaxKind.AnonymousObjectMemberDeclarator: 5166case SyntaxKind.TupleExpression: 5168case SyntaxKind.Argument: 5170case SyntaxKind.VariableDeclarator: 5172case SyntaxKind.SingleVariableDesignation: 5174case SyntaxKind.TupleElement: 5176case SyntaxKind.NamespaceDeclaration: 5178case SyntaxKind.FileScopedNamespaceDeclaration: 5180case SyntaxKind.Parameter: 5182case SyntaxKind.TypeParameter: 5184case SyntaxKind.UsingDirective: 5192case SyntaxKind.ForEachStatement: 5194case SyntaxKind.CatchDeclaration: 5196case SyntaxKind.JoinIntoClause: 5198case SyntaxKind.QueryContinuation: 5200case SyntaxKind.CompilationUnit:
Compilation\InitializerSemanticModel.cs (14)
42Debug.Assert(syntax.IsKind(SyntaxKind.VariableDeclarator) || syntax.IsKind(SyntaxKind.EnumMemberDeclaration)); 52Debug.Assert(syntax.IsKind(SyntaxKind.PropertyDeclaration)); 84case SyntaxKind.VariableDeclarator: 88case SyntaxKind.Parameter: 92case SyntaxKind.EqualsValueClause: 96case SyntaxKind.EnumMemberDeclaration: 100case SyntaxKind.PropertyDeclaration: 117case SyntaxKind.EqualsValueClause: 121case SyntaxKind.VariableDeclarator: 125case SyntaxKind.PropertyDeclaration: 129case SyntaxKind.Parameter: 133case SyntaxKind.EnumMemberDeclaration: 194case SyntaxKind.EqualsValueClause:
Compilation\MemberSemanticModel.cs (60)
240SyntaxKind kind = current.Kind(); 252else if (kind == SyntaxKind.LocalFunctionStatement) 263else if (kind == SyntaxKind.CatchClause) 270else if (kind == SyntaxKind.CatchFilterClause) 285else if (kind == SyntaxKind.TypeOfExpression && 294else if (kind == SyntaxKind.SwitchSection) 301else if (kind == SyntaxKind.ArgumentList) 310else if (kind == SyntaxKind.EqualsValueClause) 314else if (kind == SyntaxKind.Attribute) 318else if (kind == SyntaxKind.ArrowExpressionClause) 322else if (kind == SyntaxKind.ThisConstructorInitializer || kind == SyntaxKind.BaseConstructorInitializer || kind == SyntaxKind.PrimaryConstructorBaseType) 326else if (kind == SyntaxKind.ConstructorDeclaration) 330else if (kind == SyntaxKind.SwitchExpression) 334else if (kind == SyntaxKind.SwitchExpressionArm) 390case SyntaxKind.SwitchStatement: 399case SyntaxKind.ForStatement: 415case SyntaxKind.ForEachStatement: 416case SyntaxKind.ForEachVariableStatement: 418var start = stmt.Kind() == SyntaxKind.ForEachVariableStatement ? foreachStmt.InKeyword : foreachStmt.OpenParenToken; 442if (expression.Kind() == SyntaxKind.DeclarationExpression) 851else if (paramList.Parent.Kind() == SyntaxKind.LocalFunctionStatement) 919if (node.Kind() != SyntaxKind.AwaitExpression) 931if (node.UsingKeyword.IsKind(SyntaxKind.None) || node.AwaitKeyword.IsKind(SyntaxKind.None)) 943if (node.AwaitKeyword.IsKind(SyntaxKind.None)) 1371if (bindableParent != null && bindableParent.Kind() == SyntaxKind.SimpleMemberAccessExpression && ((MemberAccessExpressionSyntax)bindableParent).Expression == bindableNode) 1586case SyntaxKind.ThisConstructorInitializer: 1587case SyntaxKind.BaseConstructorInitializer: 1588case SyntaxKind.PrimaryConstructorBaseType: 1590case SyntaxKind.ArrowExpressionClause: 1593if (current.Parent == null || current.Parent.Kind() != SyntaxKind.LocalFunctionStatement) 2205case SyntaxKind.GetAccessorDeclaration: 2206case SyntaxKind.SetAccessorDeclaration: 2207case SyntaxKind.InitAccessorDeclaration: 2208case SyntaxKind.AddAccessorDeclaration: 2209case SyntaxKind.RemoveAccessorDeclaration: 2210case SyntaxKind.MethodDeclaration: 2211case SyntaxKind.ConstructorDeclaration: 2212case SyntaxKind.DestructorDeclaration: 2213case SyntaxKind.OperatorDeclaration: 2214case SyntaxKind.ConversionOperatorDeclaration: 2215case SyntaxKind.GlobalStatement: 2216case SyntaxKind.Subpattern: 2218case SyntaxKind.PositionalPatternClause: 2235case PostfixUnaryExpressionSyntax { RawKind: (int)SyntaxKind.SuppressNullableWarningExpression } n: 2256case SyntaxKind.IdentifierName: 2257case SyntaxKind.GenericName: 2266case SyntaxKind.AnonymousObjectMemberDeclarator: 2269case SyntaxKind.VariableDeclarator: // declarators are mapped in SyntaxBinder 2275Debug.Assert(parent.Kind() == SyntaxKind.VariableDeclaration); 2277if (grandparent != null && grandparent.Kind() == SyntaxKind.LocalDeclarationStatement && 2339case SyntaxKind.ParenthesizedExpression: 2340case SyntaxKind.RefExpression: 2341case SyntaxKind.RefType: 2342case SyntaxKind.ScopedType: 2362case { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression, Parent.RawKind: (int)SyntaxKind.InvocationExpression }: 2368case { RawKind: (int)SyntaxKind.ComplexElementInitializerExpression }:
Compilation\MethodBodySemanticModel.cs (20)
55Debug.Assert((syntax.Kind() == SyntaxKind.CompilationUnit) == (!IsSpeculativeSemanticModel && owner is SynthesizedSimpleProgramEntryPointSymbol)); 78case SyntaxKind.ArrowExpressionClause: 81case SyntaxKind.BaseConstructorInitializer: 82case SyntaxKind.ThisConstructorInitializer: 85case SyntaxKind.PrimaryConstructorBaseType: 88case SyntaxKind.MethodDeclaration: 89case SyntaxKind.ConversionOperatorDeclaration: 90case SyntaxKind.OperatorDeclaration: 91case SyntaxKind.ConstructorDeclaration: 92case SyntaxKind.DestructorDeclaration: 93case SyntaxKind.GetAccessorDeclaration: 94case SyntaxKind.SetAccessorDeclaration: 95case SyntaxKind.InitAccessorDeclaration: 96case SyntaxKind.AddAccessorDeclaration: 97case SyntaxKind.RemoveAccessorDeclaration: 98case SyntaxKind.CompilationUnit: 99case SyntaxKind.RecordDeclaration: 100case SyntaxKind.ClassDeclaration: 262Debug.Assert(typeDecl.Kind() is (SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration));
Compilation\SpeculativeSemanticModelWithMemberModel.cs (2)
150var attributeOrParameter = node.FirstAncestorOrSelf<SyntaxNode>(static n => n.Kind() is SyntaxKind.Attribute or SyntaxKind.Parameter);
Compilation\SyntaxTreeSemanticModel.cs (112)
247else if (node.Parent.Kind() == SyntaxKind.XmlNameAttribute && (attrSyntax = (XmlNameAttributeSyntax)node.Parent).Identifier == node) 508if (parent is BaseTypeSyntax baseType && parent.Parent != null && parent.Parent.Kind() == SyntaxKind.BaseList && baseType.Type == expression) 524if (expression.Kind() == SyntaxKind.DeclarationExpression) 788case SyntaxKind.AddAccessorDeclaration: 789case SyntaxKind.RemoveAccessorDeclaration: 790case SyntaxKind.GetAccessorDeclaration: 791case SyntaxKind.SetAccessorDeclaration: 792case SyntaxKind.InitAccessorDeclaration: 796case SyntaxKind.ConstructorDeclaration: 802case SyntaxKind.ClassDeclaration: 803case SyntaxKind.RecordDeclaration: 818case SyntaxKind.ConversionOperatorDeclaration: 819case SyntaxKind.DestructorDeclaration: 820case SyntaxKind.MethodDeclaration: 821case SyntaxKind.OperatorDeclaration: 852case SyntaxKind.MethodDeclaration: 853case SyntaxKind.ConversionOperatorDeclaration: 854case SyntaxKind.OperatorDeclaration: 862case SyntaxKind.ConstructorDeclaration: 872case SyntaxKind.ClassDeclaration: 873case SyntaxKind.RecordDeclaration: 881case SyntaxKind.DestructorDeclaration: 889case SyntaxKind.GetAccessorDeclaration: 890case SyntaxKind.SetAccessorDeclaration: 891case SyntaxKind.InitAccessorDeclaration: 892case SyntaxKind.AddAccessorDeclaration: 893case SyntaxKind.RemoveAccessorDeclaration: 901case SyntaxKind.IndexerDeclaration: 907case SyntaxKind.FieldDeclaration: 908case SyntaxKind.EventFieldDeclaration: 922case SyntaxKind.EnumMemberDeclaration: 930case SyntaxKind.PropertyDeclaration: 937case SyntaxKind.GlobalStatement: 945case SyntaxKind.CompilationUnit: 952case SyntaxKind.Attribute: 955case SyntaxKind.Parameter: 1076case SyntaxKind.CompilationUnit: 1079case SyntaxKind.MethodDeclaration: 1080case SyntaxKind.ConversionOperatorDeclaration: 1081case SyntaxKind.OperatorDeclaration: 1082case SyntaxKind.ConstructorDeclaration: 1083case SyntaxKind.DestructorDeclaration: 1090case SyntaxKind.ClassDeclaration: 1091case SyntaxKind.RecordDeclaration: 1103case SyntaxKind.GetAccessorDeclaration: 1104case SyntaxKind.SetAccessorDeclaration: 1105case SyntaxKind.InitAccessorDeclaration: 1106case SyntaxKind.AddAccessorDeclaration: 1107case SyntaxKind.RemoveAccessorDeclaration: 1114case SyntaxKind.Block: 1119case SyntaxKind.EqualsValueClause: 1122case SyntaxKind.VariableDeclarator: 1135case SyntaxKind.PropertyDeclaration: 1146case SyntaxKind.Parameter: 1163case SyntaxKind.EnumMemberDeclaration: 1180case SyntaxKind.ArrowExpressionClause: 1206case SyntaxKind.GlobalStatement: 1210if (parent.Kind() == SyntaxKind.CompilationUnit && 1235case SyntaxKind.Attribute: 1265case SyntaxKind.FieldDeclaration: 1268case SyntaxKind.EventFieldDeclaration: 1292(node.Kind() == SyntaxKind.Attribute) || (node.Kind() == SyntaxKind.Parameter); 1326if (declarationSyntax.Parent.Kind() == SyntaxKind.CompilationUnit) 1475case SyntaxKind.GlobalStatement: 1479case SyntaxKind.IncompleteMember: 1483case SyntaxKind.EventFieldDeclaration: 1484case SyntaxKind.FieldDeclaration: 1598if (declarationSyntax.Kind() == SyntaxKind.UnknownAccessorDeclaration) 1608case SyntaxKind.PropertyDeclaration: 1609case SyntaxKind.IndexerDeclaration: 1610case SyntaxKind.EventDeclaration: 1611case SyntaxKind.EventFieldDeclaration: 1616Debug.Assert(declarationSyntax.Keyword.Kind() != SyntaxKind.IdentifierToken); 1633case SyntaxKind.PropertyDeclaration: 1634case SyntaxKind.IndexerDeclaration: 1653case SyntaxKind.MethodDeclaration: 1659case SyntaxKind.PropertyDeclaration: 1665case SyntaxKind.IndexerDeclaration: 1671case SyntaxKind.EventDeclaration: 1677case SyntaxKind.DelegateDeclaration: 1680case SyntaxKind.InterfaceDeclaration: 1681case SyntaxKind.StructDeclaration: 1682case SyntaxKind.UnionDeclaration: 1683case SyntaxKind.ClassDeclaration: 1684case SyntaxKind.EnumDeclaration: 1685case SyntaxKind.RecordDeclaration: 1686case SyntaxKind.RecordStructDeclaration: 1689case SyntaxKind.VariableDeclarator: 1692case SyntaxKind.EnumMemberDeclaration: 1695case SyntaxKind.DestructorDeclaration: 1698case SyntaxKind.ConstructorDeclaration: 1699if (((ConstructorDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.StaticKeyword)) 1708case SyntaxKind.OperatorDeclaration: 1714case SyntaxKind.ConversionOperatorDeclaration: 1720case SyntaxKind.EventFieldDeclaration: 1721case SyntaxKind.FieldDeclaration: 1724case SyntaxKind.IncompleteMember: 1752case SyntaxKind.GenericName: 1753case SyntaxKind.IdentifierName: 1756case SyntaxKind.QualifiedName: 1762case SyntaxKind.AliasQualifiedName: 2355if (memberDeclaration.Parent.Kind() == SyntaxKind.CompilationUnit) 2358if (memberDeclaration.Kind() is SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration) 2389if (memberDeclaration.Kind() is SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration 2481return (node) => node.Kind() != SyntaxKind.GlobalStatement || node.Parent != unit; 2486return (node) => node.Parent != unit || node.Kind() == SyntaxKind.GlobalStatement; 2499if (typeDeclaration.Kind() is (SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration)) 2528!(node.Kind() == SyntaxKind.ArgumentList && node == typeDeclaration.PrimaryConstructorBaseTypeIfClass?.ArgumentList);
Compilation\SyntaxTreeSemanticModel_RegionAnalysisContext.cs (1)
22while (expression.Kind() == SyntaxKind.ParenthesizedExpression)
Compiler\DocumentationCommentCompiler.cs (2)
407if (trivia.Kind() is SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia)
Compiler\DocumentationCommentCompiler.DocumentationCommentWalker.cs (7)
83if (!startLessThanToken.LeadingTrivia.Any(SyntaxKind.DocumentationCommentExteriorTrivia)) 103if (endGreaterThanToken.GetNextToken() is SyntaxToken newLineToken && newLineToken.IsKind(SyntaxKind.XmlTextLiteralNewLineToken)) 141SyntaxKind nodeKind = node.Kind(); 144if (nodeKind == SyntaxKind.XmlCrefAttribute) 182else if (diagnose && nodeKind == SyntaxKind.XmlNameAttribute) 200if (nodeKind == SyntaxKind.XmlEmptyElement) 204else if (nodeKind == SyntaxKind.XmlElementStartTag)
Compiler\MethodBodySynthesizer.cs (3)
535Debug.Assert(syntax.Kind() == SyntaxKind.Block || syntax.Kind() == SyntaxKind.ArrowExpressionClause); 556if (syntax.Kind() == SyntaxKind.Block)
Compiler\MethodCompiler.cs (6)
2198case GotoStatementSyntax { RawKind: (int)SyntaxKind.GotoStatement }: 2206!(expression.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && 2238assignment.Parent?.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.WithInitializerExpression) 2246!(id.Parent is BinaryExpressionSyntax { RawKind: (int)SyntaxKind.IsExpression } isExpression && 2293if (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 (78)
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, 668SyntaxKind.UnionDeclaration => DeclarationKind.Union, 684SyntaxKind.RecordDeclaration => DeclarationKind.Record, 685SyntaxKind.RecordStructDeclaration => DeclarationKind.RecordStruct, 718StructDeclarationSyntax { RawKind: not (int)SyntaxKind.UnionDeclaration }; 734else if (node is StructDeclarationSyntax { RawKind: (int)SyntaxKind.UnionDeclaration }) 749if (record.ClassOrStructKeyword.Kind() != SyntaxKind.None) 754else if (node.Kind() is SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration or SyntaxKind.InterfaceDeclaration) 758if (node.Kind() is SyntaxKind.InterfaceDeclaration) 772else if (node.Kind() is SyntaxKind.UnionDeclaration) 782if (modifier.IsKind(SyntaxKind.StaticKeyword) && kind == DeclarationKind.Class) 786else if (modifier.IsKind(SyntaxKind.ReadOnlyKeyword) && kind is DeclarationKind.Struct or DeclarationKind.RecordStruct) 790else if (modifier.IsKind(SyntaxKind.RefKeyword) && kind is DeclarationKind.Struct or DeclarationKind.RecordStruct) 968if (!anyExtensionDeclarationSyntax && member.Kind == SyntaxKind.ExtensionBlockDeclaration) 1036return modifiers.Any((int)SyntaxKind.RequiredKeyword); 1093if (member.Kind == SyntaxKind.MethodDeclaration) 1107if (modifier.Kind == SyntaxKind.ThisKeyword) 1122case SyntaxKind.CompilationUnit: 1125case SyntaxKind.ClassDeclaration: 1126case SyntaxKind.StructDeclaration: 1127case SyntaxKind.UnionDeclaration: 1128case SyntaxKind.InterfaceDeclaration: 1129case SyntaxKind.EnumDeclaration: 1130case SyntaxKind.RecordDeclaration: 1131case SyntaxKind.RecordStructDeclaration: 1132case SyntaxKind.ExtensionBlockDeclaration: 1135case SyntaxKind.DelegateDeclaration: 1138case SyntaxKind.FieldDeclaration: 1139case SyntaxKind.EventFieldDeclaration: 1142case SyntaxKind.MethodDeclaration: 1143case SyntaxKind.OperatorDeclaration: 1144case SyntaxKind.ConversionOperatorDeclaration: 1145case SyntaxKind.ConstructorDeclaration: 1146case SyntaxKind.DestructorDeclaration: 1149case SyntaxKind.PropertyDeclaration: 1150case SyntaxKind.EventDeclaration: 1151case SyntaxKind.IndexerDeclaration: 1174case SyntaxKind.FieldDeclaration: 1184case SyntaxKind.EventFieldDeclaration: 1194case SyntaxKind.MethodDeclaration: 1206case SyntaxKind.PropertyDeclaration: 1215case SyntaxKind.EventDeclaration: 1224case SyntaxKind.ConstructorDeclaration: 1225set.Add(((Syntax.InternalSyntax.ConstructorDeclarationSyntax)member).Modifiers.Any((int)SyntaxKind.StaticKeyword) 1231case SyntaxKind.DestructorDeclaration: 1235case SyntaxKind.IndexerDeclaration: 1239case SyntaxKind.OperatorDeclaration: 1252case SyntaxKind.ConversionOperatorDeclaration: 1272case SyntaxKind.FieldDeclaration: 1273case SyntaxKind.EventFieldDeclaration: 1274case SyntaxKind.MethodDeclaration: 1275case SyntaxKind.PropertyDeclaration: 1276case SyntaxKind.EventDeclaration: 1277case SyntaxKind.ConstructorDeclaration: 1278case SyntaxKind.DestructorDeclaration: 1279case SyntaxKind.IndexerDeclaration: 1280case SyntaxKind.OperatorDeclaration: 1281case SyntaxKind.ConversionOperatorDeclaration: 1284case SyntaxKind.GlobalStatement:
Declarations\MergedTypeDeclaration.cs (9)
77case SyntaxKind.ClassDeclaration: 78case SyntaxKind.StructDeclaration: 79case SyntaxKind.UnionDeclaration: 80case SyntaxKind.InterfaceDeclaration: 81case SyntaxKind.RecordDeclaration: 82case SyntaxKind.RecordStructDeclaration: 83case SyntaxKind.ExtensionBlockDeclaration: 87case SyntaxKind.DelegateDeclaration: 91case SyntaxKind.EnumDeclaration:
DocumentationComments\SourceDocumentationCommentUtils.cs (8)
42if (syntaxNode.Kind() == SyntaxKind.VariableDeclarator) 47SyntaxKind kind = curr.Kind(); 48if (kind == SyntaxKind.FieldDeclaration || kind == SyntaxKind.EventFieldDeclaration) 68case SyntaxKind.SingleLineDocumentationCommentTrivia: 69case SyntaxKind.MultiLineDocumentationCommentTrivia: 95case SyntaxKind.WhitespaceTrivia: 96case SyntaxKind.EndOfLineTrivia:
FlowAnalysis\AbstractFlowPass_Switch.cs (1)
110if (label.Kind() == SyntaxKind.CasePatternSwitchLabel)
FlowAnalysis\ControlFlowAnalysis.cs (2)
131return ExitPoints.WhereAsArray(s => s.IsKind(SyntaxKind.ReturnStatement) || s.IsKind(SyntaxKind.YieldBreakStatement));
FlowAnalysis\FlowAnalysisPass.cs (4)
198syntax.IsKind(SyntaxKind.Block) || 199syntax.IsKind(SyntaxKind.ArrowExpressionClause) || 200syntax.IsKind(SyntaxKind.ConstructorDeclaration) || 201syntax.IsKind(SyntaxKind.CompilationUnit));
FlowAnalysis\NullableWalker.cs (4)
933if (initializerKind == (int)SyntaxKind.ThisConstructorInitializer) 939else if (initializerKind == (int)SyntaxKind.BaseConstructorInitializer) 7486if (syntax.Kind() != SyntaxKind.InvocationExpression) 7503return nameSyntax.Kind() != SyntaxKind.GenericName;
FlowAnalysis\UnassignedAddressTakenVariablesWalker.cs (1)
54if (node.Parent.Kind() == SyntaxKind.AddressOfExpression)
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (2)
608Debug.Assert(node.Syntax.IsKind(SyntaxKind.CatchClause)); 1154Debug.Assert(pendingCatch.SyntaxOpt.IsKind(SyntaxKind.TryStatement));
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (1)
377Debug.Assert(node.Syntax.IsKind(SyntaxKind.AwaitExpression) || node.WasCompilerGenerated);
Lowering\ClosureConversion\ClosureConversion.cs (7)
1786case SyntaxKind.ForStatement: 1787case SyntaxKind.ForEachStatement: 1788case SyntaxKind.ForEachVariableStatement: 1789case SyntaxKind.WhileStatement: 1790case SyntaxKind.DoStatement: 1791case SyntaxKind.SimpleLambdaExpression: 1792case SyntaxKind.ParenthesizedLambdaExpression:
Lowering\ClosureConversion\LambdaCapturedVariable.cs (2)
101(local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchSection || 102local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchExpressionArm))
Lowering\DiagnosticsPass_ExpressionTrees.cs (9)
639case SyntaxKind.ParenthesizedLambdaExpression: 642if (lambdaSyntax.AsyncKeyword.Kind() == SyntaxKind.AsyncKeyword) 646else if (lambdaSyntax.Body.Kind() == SyntaxKind.Block) 650else if (lambdaSyntax.Body.Kind() == SyntaxKind.RefExpression) 657case SyntaxKind.SimpleLambdaExpression: 660if (lambdaSyntax.AsyncKeyword.Kind() == SyntaxKind.AsyncKeyword) 664else if (lambdaSyntax.Body.Kind() == SyntaxKind.Block) 668else if (lambdaSyntax.Body.Kind() == SyntaxKind.RefExpression) 675case SyntaxKind.AnonymousMethodExpression:
Lowering\DiagnosticsPass_Warnings.cs (1)
38if (local.Syntax.Kind() == SyntaxKind.DeclarationExpression)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (19)
419SyntaxKind parentKind = returnStatement.ExpressionOpt.Syntax.Parent.Kind(); 422case SyntaxKind.ParenthesizedLambdaExpression: 423case SyntaxKind.SimpleLambdaExpression: 424case SyntaxKind.ArrowExpressionClause: 460if (!original.IsConstructorInitializer() || original.Syntax.Kind() != SyntaxKind.ConstructorDeclaration) 577case SyntaxKind.MethodDeclaration: 578case SyntaxKind.PropertyDeclaration: 579case SyntaxKind.GetAccessorDeclaration: 580case SyntaxKind.SetAccessorDeclaration: 581case SyntaxKind.InitAccessorDeclaration: 582case SyntaxKind.ConstructorDeclaration: 583case SyntaxKind.OperatorDeclaration: 597case SyntaxKind.MethodDeclaration: 601case SyntaxKind.PropertyDeclaration: 605case SyntaxKind.GetAccessorDeclaration: 606case SyntaxKind.SetAccessorDeclaration: 607case SyntaxKind.InitAccessorDeclaration: 611case SyntaxKind.ConstructorDeclaration: 615case SyntaxKind.OperatorDeclaration:
Lowering\Instrumentation\DebugInfoInjector.cs (9)
68if (ctorDecl.Modifiers.Any(SyntaxKind.StaticKeyword)) 134if (syntax.IsKind(SyntaxKind.Parameter)) 145case SyntaxKind.VariableDeclarator: 149case SyntaxKind.PropertyDeclaration: 172if (original.WasCompilerGenerated && original.Syntax.Kind() == SyntaxKind.Block) 316case SyntaxKind.ForEachStatement: 322case SyntaxKind.ForEachVariableStatement: 388return AddSequencePoint(original.Syntax.Kind() == SyntaxKind.VariableDeclarator ? 406if (original.WasCompilerGenerated && original.ExpressionOpt == null && original.Syntax.Kind() == SyntaxKind.Block)
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (7)
97case SyntaxKind.EventFieldDeclaration: 98case SyntaxKind.FieldDeclaration: 105case SyntaxKind.LocalDeclarationStatement: 109Debug.Assert(!modifiers.Any(SyntaxKind.ConstKeyword)); // const locals don't have a sequence point 119case SyntaxKind.UsingStatement: 120case SyntaxKind.FixedStatement: 121case SyntaxKind.ForStatement:
Lowering\Instrumentation\Instrumenter.cs (19)
50Debug.Assert(!original.WasCompilerGenerated || original.Syntax.Kind() == SyntaxKind.Block); 115Debug.Assert(original.Syntax.Kind() == SyntaxKind.DoStatement); 123Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); 131Debug.Assert(original.Syntax.Kind() == SyntaxKind.DoStatement); 138Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); 159Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForEachStatement); 166Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForEachVariableStatement); 180Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForStatement); 187Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForStatement); 194Debug.Assert(original.Syntax.Kind() == SyntaxKind.IfStatement); 201Debug.Assert(original.Syntax.Kind() == SyntaxKind.IfStatement); 208Debug.Assert(original.Syntax.Kind() == SyntaxKind.LabeledStatement); 214Debug.Assert(original.Syntax.Kind() == SyntaxKind.VariableDeclarator || 215(original.Syntax.Kind() == SyntaxKind.LocalDeclarationStatement && 259Debug.Assert(original.Syntax.Kind() == SyntaxKind.LockStatement); 270Debug.Assert(original.Syntax.Kind() == SyntaxKind.SwitchStatement); 289Debug.Assert(original.Syntax.Kind() == SyntaxKind.UsingStatement); 302Debug.Assert(original.Syntax.Kind() == SyntaxKind.CatchClause); 309Debug.Assert(original.Syntax.Kind() == SyntaxKind.SwitchStatement);
Lowering\LocalRewriter\LocalRewriter.cs (4)
874if (syntax.IsKind(SyntaxKind.Parameter)) 880if (syntax is ExpressionSyntax { Parent: { } parent } && parent.Kind() == SyntaxKind.EqualsValueClause) // Should be the initial value. 885case SyntaxKind.VariableDeclarator: 886case SyntaxKind.PropertyDeclaration:
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (1)
589loweredInput.Syntax.Kind() == SyntaxKind.TupleExpression &&
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (11)
89case SyntaxKind.TryStatement: 93case SyntaxKind.UsingStatement: 120case SyntaxKind.ForEachStatement: 121case SyntaxKind.ForEachVariableStatement: 127case SyntaxKind.SimpleLambdaExpression: 128case SyntaxKind.ParenthesizedLambdaExpression: 129case SyntaxKind.AnonymousMethodExpression: 132case SyntaxKind.CatchClause: 140goto case SyntaxKind.FinallyClause; 141case SyntaxKind.FinallyClause: 144Debug.Assert(node is { } && node.Kind() == SyntaxKind.TryStatement);
Lowering\LocalRewriter\LocalRewriter_LocalDeclaration.cs (2)
76(originalOpt.Syntax.Kind() == SyntaxKind.VariableDeclarator || 77(originalOpt.Syntax.Kind() == SyntaxKind.LocalDeclarationStatement &&
Lowering\LocalRewriter\LocalRewriter_PatternSwitchStatement.cs (1)
56if (section?.Kind() == SyntaxKind.SwitchSection)
Lowering\LocalRewriter\LocalRewriter_ReturnStatement.cs (1)
32(node.Syntax.Kind() == SyntaxKind.Block && (currentFunction?.IsAsync == false || isRuntimeAsync)))))
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (1)
51SyntaxToken awaitKeyword = node.Syntax.Kind() == SyntaxKind.UsingStatement ? ((UsingStatementSyntax)node.Syntax).AwaitKeyword : default;
Lowering\LocalRewriter\LocalRewriter_Yield.cs (1)
25(!node.WasCompilerGenerated || (node.Syntax.Kind() == SyntaxKind.Block && (currentFunction?.IsAsync == false || isRuntimeAsync))))
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (5)
335if ((local.SynthesizedKind == SynthesizedLocalKind.UserDefined && local.ScopeDesignatorOpt?.Kind() != SyntaxKind.SwitchSection) || 548(local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchSection || 549local.ScopeDesignatorOpt?.Kind() == SyntaxKind.SwitchExpressionArm)); 672SynthesizedLocalKind.Spill => awaitSyntax.IsKind(SyntaxKind.AwaitExpression) || awaitSyntax.IsKind(SyntaxKind.SwitchExpression),
Operations\CSharpOperationFactory.cs (6)
2168var kind = node.Kind(); 2174case SyntaxKind.LocalDeclarationStatement: 2185case SyntaxKind.VariableDeclarator: 2222SyntaxNode declarationSyntax = declarationGroupSyntax.IsKind(SyntaxKind.LocalDeclarationStatement) ? 2817if (boundSwitchLabel.Syntax.Kind() == SyntaxKind.DefaultSwitchLabel) 2849if (boundQueryClause.Syntax.Kind() != SyntaxKind.QueryExpression)
Parser\Blender.cs (2)
134Debug.Assert(token.Kind() != SyntaxKind.None, "how could we not get a real token back?"); 167if (parent.Kind() == SyntaxKind.InterpolatedStringExpression)
Parser\Blender.Cursor.cs (5)
48this.CurrentNodeOrToken.Kind() == SyntaxKind.None || 49this.CurrentNodeOrToken.Kind() == SyntaxKind.EndOfFileToken; 55return token.Kind() == SyntaxKind.EndOfFileToken || token.FullWidth != 0; 146if (node.Kind() == SyntaxKind.InterpolatedStringExpression) 182for (var node = cursor.CurrentNodeOrToken; node.Kind() != SyntaxKind.None && !SyntaxFacts.IsAnyToken(node.Kind()); node = cursor.CurrentNodeOrToken)
Parser\Blender.Reader.cs (6)
299internal static bool IsFabricatedToken(SyntaxKind kind) 303case SyntaxKind.GreaterThanGreaterThanToken: 304case SyntaxKind.GreaterThanGreaterThanEqualsToken: 305case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 306case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 307case SyntaxKind.DotDotToken:
Parser\DirectiveParser.cs (103)
37var hash = this.EatToken(SyntaxKind.HashToken, false); 50SyntaxKind contextualKind = this.CurrentToken.ContextualKind; 53case SyntaxKind.IfKeyword: 57case SyntaxKind.ElifKeyword: 61case SyntaxKind.ElseKeyword: 65case SyntaxKind.EndIfKeyword: 69case SyntaxKind.RegionKeyword: 73case SyntaxKind.EndRegionKeyword: 77case SyntaxKind.DefineKeyword: 78case SyntaxKind.UndefKeyword: 82case SyntaxKind.ErrorKeyword: 83case SyntaxKind.WarningKeyword: 87case SyntaxKind.LineKeyword: 89result = (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) ? 94case SyntaxKind.PragmaKeyword: 98case SyntaxKind.ReferenceKeyword: 102case SyntaxKind.LoadKeyword: 106case SyntaxKind.NullableKeyword: 111if (contextualKind == SyntaxKind.ExclamationToken) 119result = this.ParseShebangDirective(hash, this.EatToken(SyntaxKind.ExclamationToken), isActive); 121else if (contextualKind == SyntaxKind.ColonToken && !hash.HasTrailingTrivia) 123result = this.ParseIgnoredDirective(hash, this.EatToken(SyntaxKind.ColonToken), isActive, isFollowingToken); 127var id = this.EatToken(SyntaxKind.IdentifierToken, false); 254var name = this.EatToken(SyntaxKind.IdentifierToken, ErrorCode.ERR_IdentifierExpected); 257if (keyword.Kind == SyntaxKind.DefineKeyword) 292bool isError = keyword.Kind == SyntaxKind.ErrorKeyword; 306if (t.Kind == SyntaxKind.WhitespaceTrivia) 379case SyntaxKind.DefaultKeyword: 380case SyntaxKind.HiddenKeyword: 384line = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.ERR_InvalidLineNumber, reportError: isActive); 386if (isActive && !line.IsMissing && line.Kind == SyntaxKind.NumericLiteralToken) 398if (this.CurrentToken.Kind == SyntaxKind.StringLiteralToken && 414Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 423var minus = EatToken(SyntaxKind.MinusToken, reportError: reportError); 433var characterOffset = (CurrentToken.Kind == SyntaxKind.NumericLiteralToken) ? 442var file = EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_MissingPPFile, reportError: reportError); 463var openParen = EatToken(SyntaxKind.OpenParenToken, reportError); 468var comma = EatToken(SyntaxKind.CommaToken, reportError); 473var closeParen = EatToken(SyntaxKind.CloseParenToken, reportError); 481var token = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.ERR_LineSpanDirectiveInvalidValue, reportError: reportError); 487else if (token.Kind == SyntaxKind.NumericLiteralToken) 513SyntaxToken file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive); 533SyntaxToken file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.ERR_ExpectedPPFile, reportError: isActive); 548SyntaxKind.EnableKeyword => EatToken(), 549SyntaxKind.DisableKeyword => EatToken(), 550SyntaxKind.RestoreKeyword => EatToken(), 551_ => EatToken(SyntaxKind.DisableKeyword, ErrorCode.ERR_NullableDirectiveQualifierExpected, reportError: isActive) 556SyntaxKind.WarningsKeyword => EatToken(), 557SyntaxKind.AnnotationsKeyword => EatToken(), 558SyntaxKind.EndOfDirectiveToken => null, 559SyntaxKind.EndOfFileToken => null, 560_ => EatToken(SyntaxKind.WarningsKeyword, ErrorCode.ERR_NullableDirectiveTargetExpected, reportError: !setting.IsMissing && isActive) 575if (this.CurrentToken.ContextualKind == SyntaxKind.WarningKeyword) 577var warning = this.EatContextualToken(SyntaxKind.WarningKeyword); 579if (this.CurrentToken.Kind == SyntaxKind.DisableKeyword || this.CurrentToken.Kind == SyntaxKind.RestoreKeyword) 584while (this.CurrentToken.Kind != SyntaxKind.EndOfDirectiveToken) 589if (this.CurrentToken.Kind == SyntaxKind.NumericLiteralToken) 599idExpression = SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, id); 601else if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 615id = this.EatToken(SyntaxKind.NumericLiteralToken, ErrorCode.WRN_IdentifierOrNumericLiteralExpected, reportError: isActive); 616idExpression = SyntaxFactory.LiteralExpression(SyntaxKind.NumericLiteralExpression, id); 622if (this.CurrentToken.Kind != SyntaxKind.CommaToken) 635style = this.EatToken(SyntaxKind.DisableKeyword, ErrorCode.WRN_IllegalPPWarning, reportError: isActive); 640else if (this.CurrentToken.Kind == SyntaxKind.ChecksumKeyword) 643var file = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive); 644var guid = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !file.IsMissing); 654var bytes = this.EatToken(SyntaxKind.StringLiteralToken, ErrorCode.WRN_IllegalPPChecksum, reportError: isActive && !guid.IsMissing); 680var warning = this.EatToken(SyntaxKind.WarningKeyword, ErrorCode.WRN_IllegalPragma, reportError: isActive); 681var style = this.EatToken(SyntaxKind.DisableKeyword, reportError: false); 729if (this.CurrentToken.Kind != SyntaxKind.EndOfDirectiveToken && 730this.CurrentToken.Kind != SyntaxKind.EndOfFileToken) 749while (this.CurrentToken.Kind != SyntaxKind.EndOfDirectiveToken && 750this.CurrentToken.Kind != SyntaxKind.EndOfFileToken) 757SyntaxToken endOfDirective = this.CurrentToken.Kind == SyntaxKind.EndOfDirectiveToken 759: SyntaxFactory.Token(SyntaxKind.EndOfDirectiveToken); 778while (this.CurrentToken.Kind == SyntaxKind.BarBarToken) 782left = SyntaxFactory.BinaryExpression(SyntaxKind.LogicalOrExpression, left, op, right); 791while (this.CurrentToken.Kind == SyntaxKind.AmpersandAmpersandToken) 795left = SyntaxFactory.BinaryExpression(SyntaxKind.LogicalAndExpression, left, op, right); 804while (this.CurrentToken.Kind == SyntaxKind.EqualsEqualsToken || this.CurrentToken.Kind == SyntaxKind.ExclamationEqualsToken) 816if (this.CurrentToken.Kind == SyntaxKind.ExclamationToken) 819return SyntaxFactory.PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, op, this.ParseLogicalNot()); 827var k = this.CurrentToken.Kind; 830case SyntaxKind.OpenParenToken: 833var close = this.EatToken(SyntaxKind.CloseParenToken); 835case SyntaxKind.IdentifierToken: 838case SyntaxKind.TrueKeyword: 839case SyntaxKind.FalseKeyword: 842return SyntaxFactory.IdentifierName(this.EatToken(SyntaxKind.IdentifierToken, ErrorCode.ERR_InvalidPreprocExpr)); 858identifier = SyntaxFactory.Identifier(SyntaxKind.IdentifierToken, leading, text, identifierPart, trailing); 878case SyntaxKind.ParenthesizedExpression: 880case SyntaxKind.TrueLiteralExpression: 881case SyntaxKind.FalseLiteralExpression: 883case SyntaxKind.LogicalAndExpression: 884case SyntaxKind.BitwiseAndExpression: 886case SyntaxKind.LogicalOrExpression: 887case SyntaxKind.BitwiseOrExpression: 889case SyntaxKind.EqualsExpression: 891case SyntaxKind.NotEqualsExpression: 893case SyntaxKind.LogicalNotExpression: 895case SyntaxKind.IdentifierName:
Parser\Directives.cs (39)
26public SyntaxKind Kind 57case SyntaxKind.DefineDirectiveTrivia: 58case SyntaxKind.UndefDirectiveTrivia: 60case SyntaxKind.IfDirectiveTrivia: 61case SyntaxKind.ElifDirectiveTrivia: 62case SyntaxKind.ElseDirectiveTrivia: 81case SyntaxKind.DefineDirectiveTrivia: 83case SyntaxKind.UndefDirectiveTrivia: 158case SyntaxKind.DefineDirectiveTrivia: 165case SyntaxKind.UndefDirectiveTrivia: 173case SyntaxKind.ElifDirectiveTrivia: 174case SyntaxKind.ElseDirectiveTrivia: 185while (current.Head.Kind != SyntaxKind.IfDirectiveTrivia); 203else if (current.Head.Kind == SyntaxKind.IfDirectiveTrivia) 215return prev != null && prev.Any() && prev.Head.Kind != SyntaxKind.RegionDirectiveTrivia; 221return prev != null && prev.Any() && (prev.Head.Kind == SyntaxKind.IfDirectiveTrivia || prev.Head.Kind == SyntaxKind.ElifDirectiveTrivia); 227return prev != null && prev.Any() && prev.Head.Kind == SyntaxKind.RegionDirectiveTrivia; 234case SyntaxKind.EndIfDirectiveTrivia: 243case SyntaxKind.EndRegionDirectiveTrivia: 254seenAnyIfDirectives: _seenAnyIfDirectives || directive.Kind is SyntaxKind.IfDirectiveTrivia); 271if (stack.Head.Kind == SyntaxKind.IfDirectiveTrivia) 280case SyntaxKind.ElifDirectiveTrivia: 281case SyntaxKind.ElseDirectiveTrivia: 305if (stack.Head.Kind == SyntaxKind.RegionDirectiveTrivia) 322case SyntaxKind.IfDirectiveTrivia: 339case SyntaxKind.IfDirectiveTrivia: 340case SyntaxKind.ElifDirectiveTrivia: 341case SyntaxKind.ElseDirectiveTrivia: 342case SyntaxKind.RegionDirectiveTrivia: 355while (current != null && current.Any() && current.Head.Kind != SyntaxKind.RegionDirectiveTrivia) 417case SyntaxKind.IfDirectiveTrivia: 418case SyntaxKind.ElifDirectiveTrivia: 419case SyntaxKind.ElseDirectiveTrivia: 420case SyntaxKind.EndIfDirectiveTrivia: 421case SyntaxKind.DefineDirectiveTrivia: 422case SyntaxKind.UndefDirectiveTrivia: 423case SyntaxKind.RegionDirectiveTrivia: 424case SyntaxKind.EndRegionDirectiveTrivia:
Parser\DocumentationCommentParser.cs (210)
81if (this.CurrentToken.Kind != SyntaxKind.EndOfDocumentationCommentToken) 86var eoc = this.EatToken(SyntaxKind.EndOfDocumentationCommentToken); 89SyntaxKind kind = _isDelimited ? SyntaxKind.MultiLineDocumentationCommentTrivia : SyntaxKind.SingleLineDocumentationCommentTrivia; 101bool endTag = this.CurrentToken.Kind == SyntaxKind.LessThanSlashToken; 108while (this.CurrentToken.Kind != SyntaxKind.EndOfDocumentationCommentToken) 149case SyntaxKind.XmlTextLiteralToken: 150case SyntaxKind.XmlTextLiteralNewLineToken: 151case SyntaxKind.XmlEntityLiteralToken: 153case SyntaxKind.LessThanToken: 155case SyntaxKind.XmlCommentStartToken: 157case SyntaxKind.XmlCDataStartToken: 159case SyntaxKind.XmlProcessingInstructionStartToken: 161case SyntaxKind.EndOfDocumentationCommentToken: 173case SyntaxKind.LessThanToken: 174case SyntaxKind.LessThanSlashToken: 175case SyntaxKind.XmlCommentStartToken: 176case SyntaxKind.XmlCDataStartToken: 177case SyntaxKind.XmlProcessingInstructionStartToken: 178case SyntaxKind.GreaterThanToken: 179case SyntaxKind.SlashGreaterThanToken: 180case SyntaxKind.EndOfDocumentationCommentToken: 190while (this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken 191|| this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken 192|| this.CurrentToken.Kind == SyntaxKind.XmlEntityLiteralToken) 204var lessThan = this.EatToken(SyntaxKind.LessThanToken); // guaranteed 218if (this.CurrentToken.Kind == SyntaxKind.GreaterThanToken) 231var lessThanSlash = this.EatToken(SyntaxKind.LessThanSlashToken, reportError: false); 239endName = SyntaxFactory.XmlName(prefix: null, localName: SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken)); 240greaterThan = SyntaxFactory.MissingToken(SyntaxKind.GreaterThanToken); 258if (this.CurrentToken.Kind != SyntaxKind.GreaterThanToken) 261p => p.CurrentToken.Kind != SyntaxKind.GreaterThanToken, 267greaterThan = this.EatToken(SyntaxKind.GreaterThanToken); 281var slashGreater = this.EatToken(SyntaxKind.SlashGreaterThanToken, false); 328if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 344p => p.CurrentToken.Kind != SyntaxKind.IdentifierName, 347p => p.CurrentToken.Kind == SyntaxKind.GreaterThanToken 348|| p.CurrentToken.Kind == SyntaxKind.SlashGreaterThanToken 349|| p.CurrentToken.Kind == SyntaxKind.LessThanToken 350|| p.CurrentToken.Kind == SyntaxKind.LessThanSlashToken 351|| p.CurrentToken.Kind == SyntaxKind.EndOfDocumentationCommentToken 352|| p.CurrentToken.Kind == SyntaxKind.EndOfFileToken, 447var equals = this.EatToken(SyntaxKind.EqualsToken, false); 454case SyntaxKind.SingleQuoteToken: 455case SyntaxKind.DoubleQuoteToken: 463SyntaxFactory.MissingToken(SyntaxKind.DoubleQuoteToken), 465SyntaxFactory.MissingToken(SyntaxKind.DoubleQuoteToken)); 525SyntaxToken openQuote = EatToken(this.CurrentToken.Kind == SyntaxKind.SingleQuoteToken 526? SyntaxKind.SingleQuoteToken 527: SyntaxKind.DoubleQuoteToken); 533if ((current.Kind == SyntaxKind.XmlTextLiteralToken || current.Kind == SyntaxKind.XmlEntityLiteralToken) && 540if ((current.Kind == SyntaxKind.XmlTextLiteralToken || current.Kind == SyntaxKind.XmlEntityLiteralToken) && 556SyntaxKind quoteKind = startQuote.Kind; 559var saveMode = this.SetMode(quoteKind == SyntaxKind.SingleQuoteToken 574SyntaxKind quoteKind = startQuote.Kind; 577var saveMode = this.SetMode(quoteKind == SyntaxKind.SingleQuoteToken 592SyntaxKind quoteKind = startQuote.Kind; 602var saveMode = this.SetMode(quoteKind == SyntaxKind.SingleQuoteToken 606while (this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken 607|| this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken 608|| this.CurrentToken.Kind == SyntaxKind.XmlEntityLiteralToken 609|| this.CurrentToken.Kind == SyntaxKind.LessThanToken) 612if (token.Kind == SyntaxKind.LessThanToken) 636var quoteKind = this.CurrentToken.Kind == SyntaxKind.SingleQuoteToken 637? SyntaxKind.SingleQuoteToken 638: SyntaxKind.DoubleQuoteToken; 648private SyntaxToken ParseXmlAttributeEndQuote(SyntaxKind quoteKind) 665var quote = SyntaxFactory.MissingToken(SyntaxKind.DoubleQuoteToken); 683var id = this.EatToken(SyntaxKind.IdentifierToken); 685if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 701id = this.EatToken(SyntaxKind.IdentifierToken); 722var lessThanExclamationMinusMinusToken = this.EatToken(SyntaxKind.XmlCommentStartToken); 725while (this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken 726|| this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken 727|| this.CurrentToken.Kind == SyntaxKind.MinusMinusToken) 730if (token.Kind == SyntaxKind.MinusMinusToken) 742var minusMinusGreaterThanToken = this.EatToken(SyntaxKind.XmlCommentEndToken); 749var startCDataToken = this.EatToken(SyntaxKind.XmlCDataStartToken); 752while (this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken 753|| this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken) 758var endCDataToken = this.EatToken(SyntaxKind.XmlCDataEndToken); 765var startProcessingInstructionToken = this.EatToken(SyntaxKind.XmlProcessingInstructionStartToken); 774while (this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralToken 775|| this.CurrentToken.Kind == SyntaxKind.XmlTextLiteralNewLineToken) 785var endProcessingInstructionToken = this.EatToken(SyntaxKind.XmlProcessingInstructionEndToken); 790protected override SyntaxDiagnosticInfo GetExpectedTokenError(SyntaxKind expected, SyntaxKind actual, int offset, int length) 802case SyntaxKind.IdentifierToken: 811GreenNode missingNodeOrToken, SyntaxKind expected, SyntaxKind actual) 823case SyntaxKind.IdentifierToken: 900else if (type.Kind != SyntaxKind.QualifiedName && this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 908SyntaxToken dot = EatToken(SyntaxKind.DotToken); 942case SyntaxKind.ThisKeyword: 944case SyntaxKind.OperatorKeyword: 946case SyntaxKind.ExplicitKeyword: 947case SyntaxKind.ImplicitKeyword: 949case SyntaxKind.IdentifierToken when CurrentToken.ContextualKind == SyntaxKind.ExtensionKeyword: 973Debug.Assert(CurrentToken.Kind == SyntaxKind.ThisKeyword); 987Debug.Assert(CurrentToken.ContextualKind == SyntaxKind.ExtensionKeyword); 990TypeArgumentListSyntax? typeArguments = (CurrentToken.Kind == SyntaxKind.LessThanToken) ? ParseTypeArguments(typeArgumentsMustBeIdentifiers: true) : null; 991CrefParameterListSyntax? parameters = (CurrentToken.Kind == SyntaxKind.OpenParenToken) ? ParseCrefParameterList() : null; 993if (parameters is null || CurrentToken.Kind != SyntaxKind.DotToken) 1002SyntaxToken dotToken = EatToken(SyntaxKind.DotToken); 1018Debug.Assert(CurrentToken.Kind == SyntaxKind.OperatorKeyword); 1030operatorToken = SyntaxFactory.MissingToken(SyntaxKind.PlusToken); 1048if (operatorToken.Kind == SyntaxKind.GreaterThanToken && LanguageParser.NoTriviaBetween(operatorToken, CurrentToken)) 1050if (CurrentToken.Kind == SyntaxKind.GreaterThanToken) 1055CurrentToken.Kind is (SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken)) 1059if (operatorToken3.Kind == SyntaxKind.GreaterThanToken) 1063SyntaxKind.GreaterThanGreaterThanGreaterThanToken, 1074SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, 1085SyntaxKind.GreaterThanGreaterThanToken, 1091else if (CurrentToken.Kind == SyntaxKind.EqualsToken) 1096SyntaxKind.GreaterThanEqualsToken, 1101else if (CurrentToken.Kind == SyntaxKind.GreaterThanEqualsToken) 1106SyntaxKind.GreaterThanGreaterThanEqualsToken, 1116case SyntaxKind.PlusToken: 1117operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.PlusEqualsToken); 1119case SyntaxKind.MinusToken: 1120operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.MinusEqualsToken); 1122case SyntaxKind.AsteriskToken: 1123operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.AsteriskEqualsToken); 1125case SyntaxKind.SlashToken: 1126operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.SlashEqualsToken); 1128case SyntaxKind.PercentToken: 1129operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.PercentEqualsToken); 1131case SyntaxKind.AmpersandToken: 1132operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.AmpersandEqualsToken); 1134case SyntaxKind.BarToken: 1135operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.BarEqualsToken); 1137case SyntaxKind.CaretToken: 1138operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.CaretEqualsToken); 1140case SyntaxKind.LessThanLessThanToken: 1141operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.LessThanLessThanEqualsToken); 1143case SyntaxKind.GreaterThanGreaterThanToken: 1144operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.GreaterThanGreaterThanEqualsToken); 1146case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 1147operatorToken = tryParseCompoundAssignmentOperatorToken(operatorToken, SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken); 1157SyntaxToken tryParseCompoundAssignmentOperatorToken(SyntaxToken operatorToken, SyntaxKind kind) 1159if (LanguageParser.NoTriviaBetween(operatorToken, CurrentToken) && CurrentToken.Kind == SyntaxKind.EqualsToken) 1161Debug.Assert(kind is not (SyntaxKind.GreaterThanGreaterThanEqualsToken or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken)); // Reaching this code path is not expected 1190if (CurrentToken.Kind == SyntaxKind.UncheckedKeyword) 1198return TryEatToken(SyntaxKind.CheckedKeyword); 1207Debug.Assert(CurrentToken.Kind == SyntaxKind.ExplicitKeyword || 1208CurrentToken.Kind == SyntaxKind.ImplicitKeyword); 1211SyntaxToken operatorKeyword = EatToken(SyntaxKind.OperatorKeyword); 1242SyntaxKind openKind = useSquareBrackets ? SyntaxKind.OpenBracketToken : SyntaxKind.OpenParenToken; 1243SyntaxKind closeKind = useSquareBrackets ? SyntaxKind.CloseBracketToken : SyntaxKind.CloseParenToken; 1255while (CurrentToken.Kind == SyntaxKind.CommaToken || IsPossibleCrefParameter()) 1261SyntaxToken comma = EatToken(SyntaxKind.CommaToken); 1270Debug.Assert(CurrentToken.Kind != SyntaxKind.CommaToken); 1295SyntaxKind kind = this.CurrentToken.Kind; 1298case SyntaxKind.RefKeyword: 1299case SyntaxKind.OutKeyword: 1300case SyntaxKind.InKeyword: 1301case SyntaxKind.IdentifierToken: 1319case SyntaxKind.RefKeyword: 1320case SyntaxKind.OutKeyword: 1321case SyntaxKind.InKeyword: 1327if (CurrentToken.Kind == SyntaxKind.ReadOnlyKeyword && refKindOpt is not null) 1329if (refKindOpt.Kind != SyntaxKind.RefKeyword) 1352SyntaxToken identifierToken = EatToken(SyntaxKind.IdentifierToken); 1354if (CurrentToken.Kind != SyntaxKind.LessThanToken) 1364Debug.Assert(CurrentToken.Kind == SyntaxKind.LessThanToken); 1374if (typeArgumentsMustBeIdentifiers && typeSyntax.Kind != SyntaxKind.IdentifierName) 1382var currentKind = CurrentToken.Kind; 1383if (currentKind == SyntaxKind.CommaToken || currentKind == SyntaxKind.IdentifierToken || 1388list.AddSeparator(EatToken(SyntaxKind.CommaToken)); 1396SyntaxToken close = EatToken(SyntaxKind.GreaterThanToken); 1453else if (CurrentToken.Kind == SyntaxKind.IdentifierToken && PeekToken(1).Kind == SyntaxKind.ColonColonToken) 1457if (alias.ContextualKind == SyntaxKind.GlobalKeyword) 1473if (checkForMember && (leftName.IsMissing || CurrentToken.Kind != SyntaxKind.DotToken)) 1485while (CurrentToken.Kind == SyntaxKind.DotToken) 1494if (checkForMember && (rightName.IsMissing || CurrentToken.Kind != SyntaxKind.DotToken)) 1516if (CurrentToken.Kind == SyntaxKind.QuestionToken) 1521while (CurrentToken.Kind == SyntaxKind.AsteriskToken) 1526if (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 1528var omittedArraySizeExpressionInstance = SyntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 1532while (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 1538while (this.CurrentToken.Kind != SyntaxKind.CloseBracketToken) 1540if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 1563var close = this.EatToken(SyntaxKind.CloseBracketToken); 1592case SyntaxKind.SingleQuoteToken: 1594case SyntaxKind.DoubleQuoteToken: 1596case SyntaxKind.EndOfFileToken: 1597case SyntaxKind.EndOfDocumentationCommentToken: 1599case SyntaxKind.BadToken: 1602return CurrentToken.Text == SyntaxFacts.GetText(SyntaxKind.LessThanToken) || 1635SyntaxToken identifierToken = this.EatToken(SyntaxKind.IdentifierToken, reportError: false); 1660case SyntaxKind.SingleQuoteToken: 1662case SyntaxKind.DoubleQuoteToken: 1664case SyntaxKind.EndOfFileToken: 1665case SyntaxKind.EndOfDocumentationCommentToken: 1667case SyntaxKind.BadToken: 1670return CurrentToken.Text == SyntaxFacts.GetText(SyntaxKind.LessThanToken) ||
Parser\DocumentationCommentXmlTokens.cs (2)
40return SyntaxFactory.Identifier(SyntaxKind.None, null, text, text, trailing: null); 45return SyntaxFactory.Identifier(SyntaxKind.None, SyntaxFactory.Space, text, text, trailing: null);
Parser\LanguageParser.cs (2281)
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: 1398else if (nextToken.Kind == SyntaxKind.NamespaceKeyword) 1404nextToken.Kind is SyntaxKind.EnumKeyword or SyntaxKind.DelegateKeyword || 1425(next.ContextualKind == SyntaxKind.PartialKeyword && 1474Debug.Assert(modTok.Kind is not (SyntaxKind.OutKeyword or SyntaxKind.InKeyword)); 1497if (token.Kind == SyntaxKind.StructKeyword) 1504case SyntaxKind.RecordKeyword: 1513case SyntaxKind.UnionKeyword: 1529Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IdentifierToken && GetModifierExcludingScoped(this.CurrentToken) != DeclarationModifiers.None); 1548(this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword)) 1565var currentTokenKind = this.CurrentToken.Kind; 1567currentTokenKind == SyntaxKind.EventKeyword || 1568(currentTokenKind is SyntaxKind.ExplicitKeyword or SyntaxKind.ImplicitKeyword && PeekToken(1).Kind == SyntaxKind.OperatorKeyword)) 1587var currentTokenKind = this.CurrentToken.Kind; 1591if (currentTokenKind == SyntaxKind.EndOfFileToken) 1598if (currentTokenKind == SyntaxKind.CloseBraceToken) 1626if (currentTokenKind == SyntaxKind.NamespaceKeyword) 1631if (!parsingStatementNotDeclaration && currentTokenKind == SyntaxKind.OperatorKeyword) 1647Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword); 1651case SyntaxKind.StructKeyword: 1652case SyntaxKind.ClassKeyword: 1653case SyntaxKind.InterfaceKeyword: 1659case SyntaxKind.RecordKeyword: 1668case SyntaxKind.UnionKeyword: 1683Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword); 1687if (this.PeekToken(1).Kind == SyntaxKind.EventKeyword) 1694if (this.PeekToken(1).Kind == SyntaxKind.IdentifierToken && 1695this.PeekToken(2).Kind == SyntaxKind.OpenParenToken) 1718case SyntaxKind.IdentifierToken: 1719if (this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 1725case SyntaxKind.ThisKeyword: 1741case SyntaxKind.ClassKeyword: 1744case SyntaxKind.StructKeyword: 1747case SyntaxKind.InterfaceKeyword: 1750case SyntaxKind.DelegateKeyword: 1753case SyntaxKind.EnumKeyword: 1756case SyntaxKind.IdentifierToken: 1757Debug.Assert(CurrentToken.ContextualKind is SyntaxKind.RecordKeyword or SyntaxKind.ExtensionKeyword or SyntaxKind.UnionKeyword); 1767Debug.Assert(this.CurrentToken.Kind is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword or SyntaxKind.InterfaceKeyword || 1768this.CurrentToken.ContextualKind is SyntaxKind.RecordKeyword or SyntaxKind.ExtensionKeyword or SyntaxKind.UnionKeyword); 1778bool isExtension = keyword.Kind == SyntaxKind.ExtensionKeyword; 1779bool isUnion = keyword.Kind == SyntaxKind.UnionKeyword; 1790if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 1803var paramList = CurrentToken.Kind == SyntaxKind.OpenParenToken || isExtension 1815if (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 1826if (CurrentToken.Kind == SyntaxKind.SemicolonToken) 1828semicolon = EatToken(SyntaxKind.SemicolonToken); 1834openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 1850SyntaxKind kind = this.CurrentToken.Kind; 1872else if (kind is SyntaxKind.CloseBraceToken or SyntaxKind.EndOfFileToken || this.IsTerminator()) 1886? this.CreateMissingToken(SyntaxKind.CloseBraceToken, this.CurrentToken.Kind) 1887: this.EatToken(SyntaxKind.CloseBraceToken); 1889semicolon = TryEatToken(SyntaxKind.SemicolonToken); 1909if (this.CurrentToken.ContextualKind == SyntaxKind.RecordKeyword) 1912recordModifier = this.CurrentToken.Kind is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword 1919if (this.CurrentToken.Kind is SyntaxKind.StructKeyword or SyntaxKind.ClassKeyword && 1920this.PeekToken(1).ContextualKind == SyntaxKind.RecordKeyword && 1921this.PeekToken(2).Kind is SyntaxKind.IdentifierToken) 1950case SyntaxKind.ClassKeyword: 1966case SyntaxKind.StructKeyword: 1967case SyntaxKind.UnionKeyword: 1970keyword.Kind is SyntaxKind.UnionKeyword ? SyntaxKind.UnionDeclaration : SyntaxKind.StructDeclaration, 1984case SyntaxKind.InterfaceKeyword: 2000case SyntaxKind.RecordKeyword: 2005SyntaxKind declarationKind = recordModifier?.Kind == SyntaxKind.StructKeyword ? SyntaxKind.RecordStructDeclaration : SyntaxKind.RecordDeclaration; 2022case SyntaxKind.ExtensionKeyword: 2075SyntaxKind kind = this.CurrentToken.Kind; 2079!(kind == SyntaxKind.DelegateKeyword && this.PeekToken(1).Kind is SyntaxKind.OpenBraceToken or SyntaxKind.OpenParenToken)) 2092case SyntaxKind.OpenBraceToken: 2096case SyntaxKind.CloseBraceToken: 2105case SyntaxKind.EndOfFileToken: 2123return this.IsPossibleMemberStart() || this.CurrentToken.Kind == SyntaxKind.CloseBraceToken; 2128return this.CurrentToken.Kind is SyntaxKind.ColonToken or SyntaxKind.OpenBraceToken 2137var colon = this.TryEatToken(SyntaxKind.ColonToken); 2145list.Add(this.CurrentToken.Kind == SyntaxKind.OpenParenToken 2152if (this.CurrentToken.Kind is SyntaxKind.OpenBraceToken or SyntaxKind.SemicolonToken || 2158if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 2160list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 2179list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 2184if (skipBadBaseListTokens(ref colon, list, SyntaxKind.CommaToken) == PostSkipAction.Abort) 2192PostSkipAction skipBadBaseListTokens(ref SyntaxToken colon, SeparatedSyntaxListBuilder<BaseTypeSyntax> list, SyntaxKind expected) 2195static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleAttribute(), 2196static (p, _) => p.CurrentToken.Kind == SyntaxKind.OpenBraceToken || p.IsCurrentTokenWhereOfConstraintClause(), 2204this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword && 2205this.PeekToken(1).Kind == SyntaxKind.IdentifierToken && 2206this.PeekToken(2).Kind == SyntaxKind.ColonToken; 2211while (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 2219var where = this.EatContextualToken(SyntaxKind.WhereKeyword); 2224var colon = this.EatToken(SyntaxKind.ColonToken); 2229if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken || this.IsCurrentTokenWhereOfConstraintClause()) 2243if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 2244|| ((_termState & TerminatorState.IsEndOfTypeSignature) != 0 && this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 2245|| this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken 2246|| this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 2250else if (haveComma = (this.CurrentToken.Kind == SyntaxKind.CommaToken) || this.IsPossibleTypeParameterConstraint()) 2252SyntaxToken separatorToken = this.EatToken(SyntaxKind.CommaToken); 2254if (constraint.Kind == SyntaxKind.AllowsConstraintClause && haveComma && !this.IsPossibleTypeParameterConstraint()) 2256AddTrailingSkippedSyntax(bounds, this.AddError(separatorToken, ErrorCode.ERR_UnexpectedToken, SyntaxFacts.GetText(SyntaxKind.CommaToken))); 2272else if (skipBadTypeParameterConstraintTokens(bounds, SyntaxKind.CommaToken) == PostSkipAction.Abort) 2285PostSkipAction skipBadTypeParameterConstraintTokens(SeparatedSyntaxListBuilder<TypeParameterConstraintSyntax> list, SyntaxKind expected) 2290static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleTypeParameterConstraint(), 2291static (p, _) => p.CurrentToken.Kind == SyntaxKind.OpenBraceToken || p.IsCurrentTokenWhereOfConstraintClause(), 2300case SyntaxKind.NewKeyword: 2301case SyntaxKind.ClassKeyword: 2302case SyntaxKind.StructKeyword: 2303case SyntaxKind.DefaultKeyword: 2305case SyntaxKind.IdentifierToken: 2307return (this.CurrentToken.ContextualKind == SyntaxKind.AllowsKeyword && PeekToken(1).Kind == SyntaxKind.RefKeyword) || this.IsTrueIdentifier(); 2317SyntaxKind.NewKeyword => 2320this.EatToken(SyntaxKind.OpenParenToken), 2321this.EatToken(SyntaxKind.CloseParenToken)), 2323SyntaxKind.StructKeyword => 2325SyntaxKind.StructConstraint, 2327this.CurrentToken.Kind == SyntaxKind.QuestionToken 2328? this.AddError(this.EatToken(), ErrorCode.ERR_UnexpectedToken, SyntaxFacts.GetText(SyntaxKind.QuestionToken)) 2331SyntaxKind.ClassKeyword => 2333SyntaxKind.ClassConstraint, 2335this.TryEatToken(SyntaxKind.QuestionToken)), 2337SyntaxKind.DefaultKeyword => 2340SyntaxKind.EnumKeyword => 2347SyntaxKind.DelegateKeyword => 2348PeekToken(1).Kind == SyntaxKind.AsteriskToken 2359if (this.CurrentToken.ContextualKind == SyntaxKind.AllowsKeyword && 2360PeekToken(1).Kind == SyntaxKind.RefKeyword) 2362var allows = this.EatContextualToken(SyntaxKind.AllowsKeyword); 2370this.EatToken(SyntaxKind.RefKeyword), 2371this.EatToken(SyntaxKind.StructKeyword))); 2373if (this.CurrentToken.Kind == SyntaxKind.CommaToken && PeekToken(1).Kind == SyntaxKind.RefKeyword) 2375bounds.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 2394private static bool CanStartMember(SyntaxKind kind) 2398case SyntaxKind.AbstractKeyword: 2399case SyntaxKind.BoolKeyword: 2400case SyntaxKind.ByteKeyword: 2401case SyntaxKind.CharKeyword: 2402case SyntaxKind.ClassKeyword: 2403case SyntaxKind.ConstKeyword: 2404case SyntaxKind.DecimalKeyword: 2405case SyntaxKind.DelegateKeyword: 2406case SyntaxKind.DoubleKeyword: 2407case SyntaxKind.EnumKeyword: 2408case SyntaxKind.EventKeyword: 2409case SyntaxKind.ExternKeyword: 2410case SyntaxKind.FixedKeyword: 2411case SyntaxKind.FloatKeyword: 2412case SyntaxKind.IntKeyword: 2413case SyntaxKind.InterfaceKeyword: 2414case SyntaxKind.InternalKeyword: 2415case SyntaxKind.LongKeyword: 2416case SyntaxKind.NewKeyword: 2417case SyntaxKind.ObjectKeyword: 2418case SyntaxKind.OverrideKeyword: 2419case SyntaxKind.PrivateKeyword: 2420case SyntaxKind.ProtectedKeyword: 2421case SyntaxKind.PublicKeyword: 2422case SyntaxKind.ReadOnlyKeyword: 2423case SyntaxKind.SByteKeyword: 2424case SyntaxKind.SealedKeyword: 2425case SyntaxKind.ShortKeyword: 2426case SyntaxKind.StaticKeyword: 2427case SyntaxKind.StringKeyword: 2428case SyntaxKind.StructKeyword: 2429case SyntaxKind.UIntKeyword: 2430case SyntaxKind.ULongKeyword: 2431case SyntaxKind.UnsafeKeyword: 2432case SyntaxKind.UShortKeyword: 2433case SyntaxKind.VirtualKeyword: 2434case SyntaxKind.VoidKeyword: 2435case SyntaxKind.VolatileKeyword: 2436case SyntaxKind.IdentifierToken: 2437case SyntaxKind.TildeToken: 2438case SyntaxKind.OpenBracketToken: 2439case SyntaxKind.ImplicitKeyword: 2440case SyntaxKind.ExplicitKeyword: 2441case SyntaxKind.OpenParenToken: //tuple 2442case SyntaxKind.RefKeyword: 2454case SyntaxKind.ClassKeyword: 2455case SyntaxKind.DelegateKeyword when !IsFunctionPointerStart(): 2456case SyntaxKind.EnumKeyword: 2457case SyntaxKind.InterfaceKeyword: 2458case SyntaxKind.StructKeyword: 2461case SyntaxKind.IdentifierToken: 2465case SyntaxKind.RecordKeyword: 2474case SyntaxKind.UnionKeyword: 2496private bool CanReuseMemberDeclaration(SyntaxKind kind, bool isGlobal) 2500case SyntaxKind.ClassDeclaration: 2501case SyntaxKind.StructDeclaration: 2502case SyntaxKind.UnionDeclaration: 2503case SyntaxKind.InterfaceDeclaration: 2504case SyntaxKind.EnumDeclaration: 2505case SyntaxKind.DelegateDeclaration: 2506case SyntaxKind.EventFieldDeclaration: 2507case SyntaxKind.PropertyDeclaration: 2508case SyntaxKind.EventDeclaration: 2509case SyntaxKind.IndexerDeclaration: 2510case SyntaxKind.OperatorDeclaration: 2511case SyntaxKind.ConversionOperatorDeclaration: 2512case SyntaxKind.DestructorDeclaration: 2513case SyntaxKind.ConstructorDeclaration: 2514case SyntaxKind.NamespaceDeclaration: 2515case SyntaxKind.FileScopedNamespaceDeclaration: 2516case SyntaxKind.RecordDeclaration: 2517case SyntaxKind.RecordStructDeclaration: 2519case SyntaxKind.FieldDeclaration: 2520case SyntaxKind.MethodDeclaration: 2529case SyntaxKind.GlobalStatement: 2541const SyntaxKind parentKind = SyntaxKind.StructDeclaration; 2557internal MemberDeclarationSyntax ParseMemberDeclarationOrStatement(SyntaxKind parentKind) 2572private MemberDeclarationSyntax ParseMemberDeclarationOrStatementCore(SyntaxKind parentKind) 2576Debug.Assert(parentKind == SyntaxKind.CompilationUnit); 2615case SyntaxKind.UnsafeKeyword: 2616if (this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 2622case SyntaxKind.FixedKeyword: 2623if (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 2629case SyntaxKind.DelegateKeyword: 2639case SyntaxKind.NewKeyword: 2655if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 2668this.AddError(SyntaxFactory.MissingToken(SyntaxKind.VoidKeyword), ErrorCode.ERR_MemberNeedsType)); 2689if (this.CurrentToken.Kind == SyntaxKind.ConstKeyword) 2702if (this.CurrentToken.Kind == SyntaxKind.EventKeyword) 2708if (this.CurrentToken.Kind == SyntaxKind.FixedKeyword) 2720if (this.CurrentToken.Kind == SyntaxKind.NamespaceKeyword) 2738if ((!haveAttributes || !IsScript) && !haveModifiers && (type.Kind == SyntaxKind.RefType || !IsOperatorStart(out _, advanceParser: false))) 2742if (this.CurrentToken.Kind is not SyntaxKind.CloseBraceToken and not SyntaxKind.EndOfFileToken && 2830!type.IsMissing && type.Kind != SyntaxKind.RefType && 2964case SyntaxKind.LocalFunctionStatement: 2965case SyntaxKind.ExpressionStatement when 2969statement is ExpressionStatementSyntax { Expression.Kind: SyntaxKind.IdentifierName, SemicolonToken.IsMissing: true }: 2973case SyntaxKind.LocalDeclarationStatement: 2983if (CurrentToken.Kind == SyntaxKind.UsingKeyword) 2988if (CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 3004this.CurrentToken.ContextualKind is not (SyntaxKind.PartialKeyword or SyntaxKind.AsyncKeyword or SyntaxKind.RequiredKeyword or SyntaxKind.FileKeyword or SyntaxKind.ClosedKeyword) && 3027SyntaxKind parentKind, 3044if (attributes.Count == 0 && modifiers.Count == 0 && type.IsMissing && type.Kind != SyntaxKind.RefType) 3056else if (parentKind is SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration || 3057parentKind == SyntaxKind.CompilationUnit && !IsScript) 3134if (type.Kind != SyntaxKind.RefType && 3137|| this.CurrentToken.Kind is not SyntaxKind.OpenParenToken and not SyntaxKind.OpenBraceToken and not SyntaxKind.EqualsGreaterThanToken) && 3162if (identifierOrThisOpt?.Kind == SyntaxKind.ThisKeyword) 3183var kind = this.PeekToken(index).Kind; 3186if (kind is SyntaxKind.OpenBraceToken or SyntaxKind.EqualsGreaterThanToken) 3190if (kind is SyntaxKind.SemicolonToken) 3193if (kind is SyntaxKind.OpenBraceToken or SyntaxKind.EqualsGreaterThanToken) 3201internal MemberDeclarationSyntax ParseMemberDeclaration(SyntaxKind parentKind) 3216private MemberDeclarationSyntax ParseMemberDeclarationCore(SyntaxKind parentKind) 3220Debug.Assert(parentKind != SyntaxKind.CompilationUnit); 3245if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 3251if (this.CurrentToken.Kind == SyntaxKind.TildeToken) 3257if (this.CurrentToken.Kind == SyntaxKind.ConstKeyword) 3263if (this.CurrentToken.Kind == SyntaxKind.EventKeyword) 3269if (this.CurrentToken.Kind == SyntaxKind.FixedKeyword) 3309if (type.Kind != SyntaxKind.RefType) 3377return this.CurrentToken.ContextualKind == SyntaxKind.ExtensionKeyword && 3378(IsFeatureEnabled(MessageID.IDS_FeatureExtensions) || this.PeekToken(1).Kind == SyntaxKind.LessThanToken); 3389if (type.Kind != SyntaxKind.IdentifierName) 3392if (identifierOrThisOpt.Kind != SyntaxKind.IdentifierToken) 3396var contextualKind = identifier.ContextualKind; 3397if (contextualKind != SyntaxKind.AsyncKeyword || 3409if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 3414if (this.CurrentToken.ContextualKind == SyntaxKind.GlobalKeyword && this.PeekToken(1).Kind == SyntaxKind.UsingKeyword) 3437case SyntaxKind.DotToken: // Goo. explicit 3438case SyntaxKind.ColonColonToken: // Goo:: explicit 3439case SyntaxKind.LessThanToken: // Goo< explicit or generic method 3440case SyntaxKind.OpenBraceToken: // Goo { property 3441case SyntaxKind.EqualsGreaterThanToken: // Goo => property 3443case SyntaxKind.OpenParenToken: // Goo( method 3452return this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword or SyntaxKind.OperatorKeyword; 3474if (token.Kind != SyntaxKind.None) 3510var currentTokenKind = this.CurrentToken.Kind; 3511var shouldParse = currentTokenKind is SyntaxKind.ColonToken || 3512(currentTokenKind is SyntaxKind.EqualsGreaterThanToken && 3513this.PeekToken(1).Kind is SyntaxKind.ThisKeyword or SyntaxKind.BaseKeyword && 3514this.PeekToken(2).Kind is SyntaxKind.OpenParenToken); 3527Debug.Assert(this.CurrentToken.Kind is SyntaxKind.ColonToken or SyntaxKind.EqualsGreaterThanToken); 3528var colon = this.EatTokenAsKind(SyntaxKind.ColonToken); 3530var token = this.CurrentToken.Kind is SyntaxKind.BaseKeyword or SyntaxKind.ThisKeyword 3532: this.EatToken(SyntaxKind.ThisKeyword, ErrorCode.ERR_ThisOrBaseExpected); 3534var argumentList = this.CurrentToken.Kind == SyntaxKind.OpenParenToken 3537this.EatToken(SyntaxKind.OpenParenToken, reportError: !token.ContainsDiagnostics), 3539this.EatToken(SyntaxKind.CloseParenToken, reportError: !token.ContainsDiagnostics)); 3542token.Kind == SyntaxKind.BaseKeyword 3543? SyntaxKind.BaseConstructorInitializer 3544: SyntaxKind.ThisConstructorInitializer, 3552Debug.Assert(this.CurrentToken.Kind == SyntaxKind.TildeToken); 3553var tilde = this.EatToken(SyntaxKind.TildeToken); 3557this.EatToken(SyntaxKind.OpenParenToken), 3559this.EatToken(SyntaxKind.CloseParenToken)); 3578if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 3582semicolon = this.EatToken(SyntaxKind.SemicolonToken); 3586blockBody = this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 3590expressionBody = this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken 3598semicolon = this.EatToken(SyntaxKind.SemicolonToken); 3601else if (parseSemicolonAfterBlock && this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 3613if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 3619if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 3625if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken) 3641=> this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.OpenBraceToken; 3645return this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.OpenBraceToken; 3649=> this.CurrentToken.Kind is SyntaxKind.DotToken or SyntaxKind.ColonColonToken; 3652=> this.CurrentToken.Kind == (errored ? SyntaxKind.CloseParenToken : SyntaxKind.GreaterThanToken); 3655=> this.CurrentToken.Kind == SyntaxKind.CloseBracketToken; 3672if (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 3677else if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 3699using var _ = new ParserSyntaxContextResetter(this, isInAsyncContext: modifiers.Any((int)SyntaxKind.AsyncKeyword)); 3729case SyntaxKind.OpenParenToken: 3730case SyntaxKind.OpenBraceToken: 3731case SyntaxKind.SemicolonToken: 3746if (this.CurrentToken.Kind is not (SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword)) 3748SyntaxKind separatorKind = SyntaxKind.None; 3750if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 3760if (this.CurrentToken.Kind == SyntaxKind.OperatorKeyword) 3774(IsMakingProgress(ref lastTokenPosition, assertIfFalse: false) && this.CurrentToken.Kind != SyntaxKind.OpenParenToken)) 3785separatorKind = SyntaxKind.None; 3802if (this.CurrentToken.Kind != SyntaxKind.OperatorKeyword || 3803(haveExplicitInterfaceName && separatorKind is not SyntaxKind.DotToken)) 3807else if (this.PeekToken(1).Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword) 3824var style = this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword 3826: this.EatToken(SyntaxKind.ExplicitKeyword); 3834if (!style.IsMissing && explicitInterfaceOpt is not null && this.CurrentToken.Kind != SyntaxKind.OperatorKeyword && style.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia)) 3840opKeyword = this.EatToken(SyntaxKind.OperatorKeyword); 3852SyntaxFactory.MissingToken(SyntaxKind.OpenParenToken), 3854SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken)), 3857semicolonToken: SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken)); 3860opKeyword = this.EatToken(SyntaxKind.OperatorKeyword); 3866bool couldBeParameterList = this.CurrentToken.Kind == SyntaxKind.OpenParenToken; 3871this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 3902if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 3919if (this.CurrentToken.Kind == SyntaxKind.OperatorKeyword) 3929(IsMakingProgress(ref lastTokenPosition, assertIfFalse: false) && this.CurrentToken.Kind != SyntaxKind.OpenParenToken); 3936if (separator?.Kind == SyntaxKind.ColonColonToken) 3939separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 3956if (separator.Kind != SyntaxKind.DotToken) 3958separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.Kind, separator.GetLeadingTriviaWidth(), separator.Width)); 3959separator = ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 3968if (CurrentToken.Kind == SyntaxKind.UncheckedKeyword) 3976return TryEatToken(SyntaxKind.CheckedKeyword); 3988if (firstToken.Kind is SyntaxKind.ExplicitKeyword or SyntaxKind.ImplicitKeyword && 3989this.PeekToken(1).Kind is SyntaxKind.OperatorKeyword) 4014var opKeyword = this.EatToken(SyntaxKind.OperatorKeyword); 4029if (this.CurrentToken.Kind is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword) 4033opToken = this.ConvertToMissingWithTrailingTrivia(this.EatToken(), SyntaxKind.PlusToken); 4040SyntaxDiagnosticInfo diagInfo = MakeError(opTokenErrorOffset, opTokenErrorWidth, ErrorCode.ERR_BadOperatorSyntax, SyntaxFacts.GetText(SyntaxKind.PlusToken)); 4046type = this.AddError(type, ErrorCode.ERR_BadOperatorSyntax, SyntaxFacts.GetText(SyntaxKind.PlusToken)); 4062if (opToken.Kind == SyntaxKind.GreaterThanToken) 4066if (tk.Kind == SyntaxKind.GreaterThanToken) 4073if (tk.Kind == SyntaxKind.GreaterThanToken && 4077opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanGreaterThanToken, opToken2.GetTrailingTrivia()); 4080else if (tk.Kind == SyntaxKind.GreaterThanEqualsToken && 4084opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, opToken2.GetTrailingTrivia()); 4089opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanToken, opToken2.GetTrailingTrivia()); 4094else if (tk.Kind == SyntaxKind.GreaterThanEqualsToken && 4098opToken = SyntaxFactory.Token(opToken.GetLeadingTrivia(), SyntaxKind.GreaterThanGreaterThanEqualsToken, opToken2.GetTrailingTrivia()); 4103var opKind = opToken.Kind; 4136if (opKind is not (SyntaxKind.PlusPlusToken or SyntaxKind.MinusMinusToken) || paramList.Parameters.Count != 0) 4157if (!(opKind == SyntaxKind.IsKeyword || 4162opToken = ConvertToMissingWithTrailingTrivia(opToken, SyntaxKind.PlusToken); 4187Debug.Assert(thisKeyword.Kind == SyntaxKind.ThisKeyword); 4203if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken) 4206semicolon = this.EatToken(SyntaxKind.SemicolonToken); 4211if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 4220if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken 4224semicolon = this.EatToken(SyntaxKind.SemicolonToken); 4255if (this.CurrentToken.Kind is SyntaxKind.SemicolonToken) 4257identifier = AddTrailingSkippedSyntax(identifier, this.EatTokenEvenWithIncorrectKind(SyntaxKind.OpenBraceToken)); 4263var accessorList = this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 4271if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken) 4277else if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 4279var equals = this.EatToken(SyntaxKind.EqualsToken); 4287semicolon = this.EatToken(SyntaxKind.SemicolonToken); 4289else if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 4364var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 4374if (this.CurrentToken.Kind == SyntaxKind.CloseBraceToken) 4396this.EatToken(SyntaxKind.CloseBraceToken)); 4402this.EatToken(SyntaxKind.EqualsGreaterThanToken), 4409var refKeyword = this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression) 4420static p => p.CurrentToken.Kind != SyntaxKind.CloseBraceToken && !p.IsPossibleAccessor(), 4427return this.CurrentToken.Kind == SyntaxKind.IdentifierToken 4429|| SyntaxFacts.GetAccessorDeclarationKind(this.CurrentToken.ContextualKind) != SyntaxKind.None 4430|| this.CurrentToken.Kind == SyntaxKind.OpenBraceToken // for accessor blocks w/ missing keyword 4431|| this.CurrentToken.Kind == SyntaxKind.SemicolonToken // for empty body accessors w/ missing keyword 4465if (token.Kind is SyntaxKind.CloseBraceToken or SyntaxKind.EndOfFileToken) 4474case SyntaxKind.GetKeyword: 4475case SyntaxKind.SetKeyword: 4476case SyntaxKind.InitKeyword: 4477case SyntaxKind.AddKeyword: 4478case SyntaxKind.RemoveKeyword: 4495Func<LanguageParser, SyntaxKind, bool> abortFunction, 4496SyntaxKind expected, 4497SyntaxKind closeKind = SyntaxKind.None) 4537Func<LanguageParser, SyntaxKind, bool> abortFunction, 4538SyntaxKind expected, 4539SyntaxKind closeKind, 4585Func<LanguageParser, SyntaxKind, bool> abortFunction, 4586SyntaxKind expected, 4587SyntaxKind closeKind, 4650var accessorName = this.EatToken(SyntaxKind.IdentifierToken, 4652var accessorKind = GetAccessorKind(accessorName); 4657if (accessorKind == SyntaxKind.UnknownAccessorDeclaration) 4683bool currentTokenIsSemicolon = this.CurrentToken.Kind == SyntaxKind.SemicolonToken; 4684bool currentTokenIsArrow = this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken; 4685bool currentTokenIsOpenBraceToken = this.CurrentToken.Kind == SyntaxKind.OpenBraceToken; 4705if (accessorKind != SyntaxKind.UnknownAccessorDeclaration) 4736=> this.EatToken(SyntaxKind.SemicolonToken, 4741private static SyntaxKind GetAccessorKind(SyntaxToken accessorName) 4745SyntaxKind.GetKeyword => SyntaxKind.GetAccessorDeclaration, 4746SyntaxKind.SetKeyword => SyntaxKind.SetAccessorDeclaration, 4747SyntaxKind.InitKeyword => SyntaxKind.InitAccessorDeclaration, 4748SyntaxKind.AddKeyword => SyntaxKind.AddAccessorDeclaration, 4749SyntaxKind.RemoveKeyword => SyntaxKind.RemoveAccessorDeclaration, 4750_ => SyntaxKind.UnknownAccessorDeclaration, 4761var parameters = this.ParseParameterList(out var open, out var close, SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken, forExtensionOrUnion); 4772var parameters = this.ParseParameterList(out var open, out var close, SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken, forExtensionOrUnion: false); 4835SyntaxKind openKind, 4836SyntaxKind closeKind, 4864LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 4867static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleParameter(), 4875return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken or SyntaxKind.SemicolonToken; 4882case SyntaxKind.OpenBracketToken: // attribute 4883case SyntaxKind.ArgListKeyword: 4884case SyntaxKind.OpenParenToken: // tuple 4885case SyntaxKind.DelegateKeyword when IsFunctionPointerStart(): // Function pointer type 4888case SyntaxKind.IdentifierToken: 4916if (parent.Kind() == SyntaxKind.SimpleLambdaExpression) 4922if (grandparent != null && grandparent.Kind() == SyntaxKind.ParenthesizedLambdaExpression) 4924Debug.Assert(parent.Kind() == SyntaxKind.ParameterList); 4932if (!identifierIsOptional && parameter.Identifier.Kind() == SyntaxKind.None) 4954if (this.CurrentToken.Kind == SyntaxKind.ArgListKeyword) 4959attributes, modifiers.ToList(), type: null, this.EatToken(SyntaxKind.ArgListKeyword), @default: null); 4965if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && IsCurrentTokenWhereOfConstraintClause()) 4972identifier = identifierIsOptional && this.CurrentToken.Kind != SyntaxKind.IdentifierToken 4978if (identifier is not null && this.CurrentToken.Kind is SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind is SyntaxKind.CloseBracketToken) 4985var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 5001=> IsParameterModifierExcludingScoped(token) || token.ContextualKind == SyntaxKind.ScopedKeyword; 5007case SyntaxKind.ThisKeyword: 5008case SyntaxKind.RefKeyword: 5009case SyntaxKind.OutKeyword: 5010case SyntaxKind.InKeyword: 5011case SyntaxKind.ParamsKeyword: 5012case SyntaxKind.ReadOnlyKeyword: 5041modifiers.Add(this.EatContextualToken(SyntaxKind.ScopedKeyword)); 5055if (this.PeekToken(1).Kind is not (SyntaxKind.CloseParenToken or SyntaxKind.CommaToken or SyntaxKind.EqualsToken)) 5057modifiers.Add(this.EatContextualToken(SyntaxKind.ScopedKeyword)); 5071SyntaxKind parentKind) 5073Debug.Assert(this.CurrentToken.Kind == SyntaxKind.FixedKeyword); 5083this.EatToken(SyntaxKind.SemicolonToken)); 5089SyntaxKind parentKind) 5091Debug.Assert(this.CurrentToken.Kind == SyntaxKind.EventKeyword); 5096return IsFieldDeclaration(isEvent: true, isGlobalScriptLevel: parentKind == SyntaxKind.CompilationUnit) 5115if (explicitInterfaceOpt != null && this.CurrentToken.Kind is not SyntaxKind.OpenBraceToken and not SyntaxKind.SemicolonToken) 5128SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken), 5130SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken)), 5140else if (identifierOrThisOpt.Kind != SyntaxKind.IdentifierToken) 5142Debug.Assert(identifierOrThisOpt.Kind == SyntaxKind.ThisKeyword); 5143identifier = ConvertToMissingWithTrailingTrivia(identifierOrThisOpt, SyntaxKind.IdentifierToken); 5151Debug.Assert(identifier.Kind == SyntaxKind.IdentifierToken); 5167if (explicitInterfaceOpt != null && this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 5169semicolon = this.EatToken(SyntaxKind.SemicolonToken); 5194if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 5208SyntaxKind parentKind) 5213if (modifiers is [.., SyntaxToken { Kind: SyntaxKind.ScopedKeyword } scopedKeyword]) 5223this.EatToken(SyntaxKind.SemicolonToken)); 5231SyntaxKind parentKind) 5247if (this.CurrentToken.Kind == SyntaxKind.DotToken) 5258this.EatToken(SyntaxKind.SemicolonToken)); 5263return this.CurrentToken.Kind == SyntaxKind.SemicolonToken; 5267TypeSyntax type, VariableFlags flags, SyntaxKind parentKind) 5272parentKind is not SyntaxKind.NamespaceDeclaration and not SyntaxKind.FileScopedNamespaceDeclaration && 5273(parentKind != SyntaxKind.CompilationUnit || IsScript); 5328if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 5332else if (stopOnCloseParen && this.CurrentToken.Kind == SyntaxKind.CloseParenToken) 5336else if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 5351if (flags.HasFlag(VariableFlags.ForStatement) && this.PeekToken(1).Kind != SyntaxKind.SemicolonToken) 5355this.PeekToken(2).Kind is SyntaxKind.CommaToken or SyntaxKind.EqualsToken or SyntaxKind.SemicolonToken; 5361variables.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 5374else if (!variableDeclarationsExpected || this.SkipBadVariableListTokens(variables, SyntaxKind.CommaToken) == PostSkipAction.Abort) 5381private PostSkipAction SkipBadVariableListTokens(SeparatedSyntaxListBuilder<VariableDeclaratorSyntax> list, SyntaxKind expected) 5386static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 5387static (p, _) => p.CurrentToken.Kind == SyntaxKind.SemicolonToken, 5407case SyntaxKind.FieldDeclaration: 5409case SyntaxKind.MethodDeclaration: 5411case SyntaxKind.ConstructorDeclaration: 5413case SyntaxKind.DestructorDeclaration: 5415case SyntaxKind.PropertyDeclaration: 5417case SyntaxKind.EventFieldDeclaration: 5419case SyntaxKind.AddAccessorDeclaration: 5420case SyntaxKind.RemoveAccessorDeclaration: 5421case SyntaxKind.GetAccessorDeclaration: 5422case SyntaxKind.SetAccessorDeclaration: 5423case SyntaxKind.InitAccessorDeclaration: 5425case SyntaxKind.ClassDeclaration: 5426case SyntaxKind.StructDeclaration: 5427case SyntaxKind.UnionDeclaration: 5428case SyntaxKind.InterfaceDeclaration: 5429case SyntaxKind.RecordDeclaration: 5430case SyntaxKind.RecordStructDeclaration: 5432case SyntaxKind.DelegateDeclaration: 5455if (mods.Any(SyntaxKind.FixedKeyword)) 5460if (mods.Any(SyntaxKind.ConstKeyword)) 5465if (parent != null && (parent.Kind() == SyntaxKind.VariableDeclaration || parent.Kind() == SyntaxKind.LocalDeclarationStatement)) 5480SyntaxKind oldKind; 5485&& (oldKind = GetOldParent(old).Kind()) != SyntaxKind.VariableDeclaration // or in a method body 5486&& oldKind != SyntaxKind.LocalDeclarationStatement; 5542var currentTokenKind = this.CurrentToken.Kind; 5543if (currentTokenKind == SyntaxKind.IdentifierToken && !parentType.IsMissing) 5545var isAfterNewLine = parentType.GetLastToken().TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia); 5556currentTokenKind != SyntaxKind.EqualsToken && 5559if (currentTokenKind is SyntaxKind.DotToken or SyntaxKind.OpenParenToken or SyntaxKind.MinusGreaterThanToken || 5562var isPossibleLocalFunctionToken = currentTokenKind is SyntaxKind.OpenParenToken or SyntaxKind.LessThanToken; 5605case SyntaxKind.EqualsToken: 5614var refKeyword = isLocalOrField && !isConst && this.CurrentToken.Kind == SyntaxKind.RefKeyword && !this.IsPossibleLambdaExpression(Precedence.Expression) 5624case SyntaxKind.LessThanToken: 5635case SyntaxKind.OpenParenToken: 5653case SyntaxKind.OpenBracketToken: 5672bool isOmitted = expression.Kind == SyntaxKind.OmittedArraySizeExpression; 5691if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 5693goto case SyntaxKind.EqualsToken; 5709Debug.Assert(this.CurrentToken.Kind != SyntaxKind.EqualsToken); 5716this.EatToken(SyntaxKind.EqualsToken), 5726if (parentType.Kind == SyntaxKind.ArrayType) 5733goto case SyntaxKind.OpenBracketToken; 5749if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 5763this.CurrentToken.Kind == SyntaxKind.IdentifierToken && 5764this.PeekToken(1).Kind is SyntaxKind.IdentifierToken or SyntaxKind.CommaToken or SyntaxKind.EqualsToken or SyntaxKind.SemicolonToken or SyntaxKind.CloseParenToken or SyntaxKind.EndOfFileToken; 5788Debug.Assert(this.CurrentToken.Kind is SyntaxKind.OpenParenToken or SyntaxKind.LessThanToken); 5796(this.CurrentToken.Kind is SyntaxKind.OpenBraceToken or SyntaxKind.EqualsGreaterThanToken || 5797this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword)) 5809case SyntaxKind.CommaToken: 5810case SyntaxKind.SemicolonToken: 5819return this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 5826return this.CurrentToken.Kind == SyntaxKind.OpenBraceToken || this.IsPossibleExpression(); 5829private FieldDeclarationSyntax ParseConstantFieldDeclaration(SyntaxList<AttributeListSyntax> attributes, SyntaxListBuilder modifiers, SyntaxKind parentKind) 5831modifiers.Add(this.EatToken(SyntaxKind.ConstKeyword)); 5840this.EatToken(SyntaxKind.SemicolonToken)); 5845Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DelegateKeyword); 5847var delegateToken = this.EatToken(SyntaxKind.DelegateKeyword); 5856if (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 5873this.EatToken(SyntaxKind.SemicolonToken)); 5878Debug.Assert(this.CurrentToken.Kind == SyntaxKind.EnumKeyword); 5880var enumToken = this.EatToken(SyntaxKind.EnumKeyword); 5893if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 5895var colon = this.EatToken(SyntaxKind.ColonToken); 5909if (CurrentToken.Kind == SyntaxKind.SemicolonToken) 5911semicolon = EatToken(SyntaxKind.SemicolonToken); 5917openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 5926SyntaxKind.CloseBraceToken, 5935closeBrace = this.EatToken(SyntaxKind.CloseBraceToken); 5936semicolon = TryEatToken(SyntaxKind.SemicolonToken); 5951LanguageParser @this, ref SyntaxToken openBrace, SeparatedSyntaxListBuilder<EnumMemberDeclarationSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 5954static p => p.CurrentToken.Kind is not SyntaxKind.CommaToken and not SyntaxKind.SemicolonToken && !p.IsPossibleEnumMemberDeclaration(), 5962if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.EnumMemberDeclaration) 5970if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 5974this.EatToken(SyntaxKind.EqualsToken), 5975this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.CloseBraceToken 5985return this.CurrentToken.Kind == SyntaxKind.OpenBracketToken || this.IsTrueIdentifier(); 5990return this.CurrentToken.Kind is SyntaxKind.DotToken or SyntaxKind.ColonColonToken; 6006return SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken); 6029if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 6049token.Kind == SyntaxKind.IdentifierToken && 6055if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.IdentifierName) 6069var ctk = this.CurrentToken.Kind; 6070if (ctk == SyntaxKind.IdentifierToken) 6087if (this.IsInAsync && identifierToken.ContextualKind == SyntaxKind.AwaitKeyword) 6107if (this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword) 6120return CurrentToken.ContextualKind == SyntaxKind.FieldKeyword && 6127if (this.CurrentToken.Kind != SyntaxKind.LessThanToken) 6135var open = this.EatToken(SyntaxKind.LessThanToken); 6138SyntaxKind.GreaterThanToken, 6151this.EatToken(SyntaxKind.GreaterThanToken)); 6154LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<TypeParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 6157static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 6170if (this.CurrentToken.Kind is SyntaxKind.OpenBracketToken or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 6179if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 6198this.CurrentToken.Kind is SyntaxKind.InKeyword or SyntaxKind.OutKeyword ? EatToken() : null, 6215if (this.CurrentToken.Kind == SyntaxKind.LessThanToken) 6225Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6250if (this.CurrentToken.Kind != SyntaxKind.LessThanToken) 6298Debug.Assert(greaterThanToken.Kind == SyntaxKind.GreaterThanToken); 6302case SyntaxKind.OpenParenToken: 6303case SyntaxKind.CloseParenToken: 6304case SyntaxKind.CloseBracketToken: 6305case SyntaxKind.CloseBraceToken: 6306case SyntaxKind.ColonToken: 6307case SyntaxKind.SemicolonToken: 6308case SyntaxKind.CommaToken: 6309case SyntaxKind.DotToken: 6310case SyntaxKind.QuestionToken: 6311case SyntaxKind.EqualsEqualsToken: 6312case SyntaxKind.ExclamationEqualsToken: 6313case SyntaxKind.BarToken: 6314case SyntaxKind.CaretToken: 6318case SyntaxKind.AmpersandAmpersandToken: // e.g. `e is A<B> && e` 6319case SyntaxKind.BarBarToken: // e.g. `e is A<B> || e` 6320case SyntaxKind.AmpersandToken: // e.g. `e is A<B> & e` 6321case SyntaxKind.OpenBracketToken: // e.g. `e is A<B>[]` 6322case SyntaxKind.LessThanToken: // e.g. `e is A<B> < C` 6323case SyntaxKind.LessThanEqualsToken: // e.g. `e is A<B> <= C` 6324case SyntaxKind.GreaterThanEqualsToken: // e.g. `e is A<B> >= C` 6325case SyntaxKind.IsKeyword: // e.g. `e is A<B> is bool` 6326case SyntaxKind.AsKeyword: // e.g. `e is A<B> as bool` 6330case SyntaxKind.OpenBraceToken: // e.g. `e is A<B> {}` 6334case SyntaxKind.GreaterThanToken when ((options & NameOptions.AfterIs) != 0) && this.PeekToken(1).Kind != SyntaxKind.GreaterThanToken: 6344case SyntaxKind.IdentifierToken: 6355(options & NameOptions.AfterTupleComma) != 0 && this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken || 6356(options & NameOptions.FirstElementOfPossibleTupleLiteral) != 0 && this.PeekToken(1).Kind == SyntaxKind.CommaToken) 6364case SyntaxKind.EndOfFileToken: // e.g. `e is A<B>` 6368case SyntaxKind.EqualsGreaterThanToken: // e.g. `e switch { A<B> => 1 }` 6382Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6392while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 6395Debug.Assert(start.Kind == SyntaxKind.LessThanToken); 6396Debug.Assert(greaterThanToken.Kind == SyntaxKind.GreaterThanToken); 6409if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 6415if (this.CurrentToken.Kind == SyntaxKind.GreaterThanToken) 6424if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 6459isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken; 6486isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken; 6508isDefinitelyTypeArgumentList = this.CurrentToken.Kind == SyntaxKind.CommaToken; 6526while (this.CurrentToken.Kind == SyntaxKind.CommaToken); 6528if (this.CurrentToken.Kind != SyntaxKind.GreaterThanToken) 6534if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken) 6536greaterThanToken = this.EatToken(SyntaxKind.GreaterThanToken); 6543if (lastScannedType is ScanTypeFlags.TupleType && this.CurrentToken.Kind is SyntaxKind.OpenParenToken) 6545greaterThanToken = this.EatToken(SyntaxKind.GreaterThanToken); 6556isDefinitelyTypeArgumentList = isDefinitelyTypeArgumentList || this.CurrentToken.Kind is SyntaxKind.CloseParenToken; 6568Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6570open = this.EatToken(SyntaxKind.LessThanToken); 6576var omittedTypeArgumentInstance = _syntaxFactory.OmittedTypeArgument(SyntaxFactory.Token(SyntaxKind.OmittedTypeArgumentToken)); 6578while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 6580types.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 6584close = this.EatToken(SyntaxKind.GreaterThanToken); 6595if (this.CurrentToken.Kind == SyntaxKind.GreaterThanToken) 6611if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken && tokenBreaksTypeArgumentList(this.PeekToken(1))) 6620if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken 6621&& this.PeekToken(1).Kind is SyntaxKind.CloseBracketToken) 6626if (this.CurrentToken.Kind == SyntaxKind.CommaToken || this.IsPossibleType()) 6628types.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 6631else if (this.SkipBadTypeArgumentListTokens(types, SyntaxKind.CommaToken) == PostSkipAction.Abort) 6637close = this.EatToken(SyntaxKind.GreaterThanToken); 6641var contextualKind = SyntaxFacts.GetContextualKeywordKind(token.ValueText); 6645case SyntaxKind.OrKeyword: 6647case SyntaxKind.AndKeyword: 6659case SyntaxKind.OpenParenToken: 6662case SyntaxKind.LessThanToken: 6664case SyntaxKind.CloseParenToken: 6666case SyntaxKind.SemicolonToken: 6668case SyntaxKind.OpenBraceToken: 6673case SyntaxKind.CloseBraceToken: 6677case SyntaxKind.EqualsToken: 6679case SyntaxKind.EqualsGreaterThanToken: 6681case SyntaxKind.ThisKeyword: 6683case SyntaxKind.OperatorKeyword: 6691private PostSkipAction SkipBadTypeArgumentListTokens(SeparatedSyntaxListBuilder<TypeSyntax> list, SyntaxKind expected) 6696static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleType(), 6697static (p, _) => p.CurrentToken.Kind == SyntaxKind.GreaterThanToken, 6705if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && this.PeekToken(1).Kind != SyntaxKind.CloseBracketToken) 6721var varianceToken = this.CurrentToken.Kind is SyntaxKind.InKeyword or SyntaxKind.OutKeyword 6748this.CurrentToken.Kind is not SyntaxKind.CommaToken and not SyntaxKind.GreaterThanToken && 6749this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken) 6770=> this.CurrentToken.Kind == SyntaxKind.GreaterThanToken; 6774Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6776while (this.PeekToken(n).Kind == SyntaxKind.CommaToken) 6779return this.PeekToken(n).Kind == SyntaxKind.GreaterThanToken; 6812if (this.CurrentToken.Kind == SyntaxKind.ThisKeyword) 6838if (separator != null && separator.Kind == SyntaxKind.ColonColonToken) 6841separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 6857if (separator.Kind != SyntaxKind.DotToken) 6859separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.Kind, separator.GetLeadingTriviaWidth(), separator.Width)); 6860separator = ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 6863if (isEvent && this.CurrentToken.Kind is not SyntaxKind.OpenBraceToken and not SyntaxKind.SemicolonToken) 6896if (separator.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia)) 6934separator = this.CurrentToken.Kind == SyntaxKind.ColonColonToken 6936: this.EatToken(SyntaxKind.DotToken); 6947if (this.CurrentToken.Kind == SyntaxKind.ColonColonToken) 6951separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 6955separator = this.EatToken(SyntaxKind.DotToken); 6976if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 7012if (separator != null && separator.Kind == SyntaxKind.ColonColonToken) 7015separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 7039if (separator.Kind != SyntaxKind.DotToken) 7041separator = WithAdditionalDiagnostics(separator, GetExpectedTokenError(SyntaxKind.DotToken, separator.Kind, separator.GetLeadingTriviaWidth(), separator.Width)); 7042separator = ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 7052return this.CurrentToken.Kind == SyntaxKind.ColonColonToken 7064if (this.PeekToken(1).Kind == SyntaxKind.ThisKeyword) 7081Debug.Assert(separator.Kind is SyntaxKind.DotToken or SyntaxKind.ColonColonToken); 7086case SyntaxKind.DotToken: 7089case SyntaxKind.ColonColonToken: 7090if (left.Kind != SyntaxKind.IdentifierName) 7101separator = this.ConvertToMissingWithTrailingTrivia(separator, SyntaxKind.DotToken); 7106if (identifierLeft.Identifier.ContextualKind == SyntaxKind.GlobalKeyword) 7121private SyntaxToken ConvertToMissingWithTrailingTrivia(SyntaxToken token, SyntaxKind expectedKind) 7182var tk = this.CurrentToken.Kind; 7203if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken || !this.IsTrueIdentifier()) 7210if (this.CurrentToken.Kind == SyntaxKind.LessThanToken) 7225if (this.CurrentToken.Kind == SyntaxKind.RefKeyword) 7230if (this.CurrentToken.Kind == SyntaxKind.ReadOnlyKeyword) 7237if (this.CurrentToken.Kind is SyntaxKind.IdentifierToken or SyntaxKind.ColonColonToken) 7240if (this.CurrentToken.Kind is SyntaxKind.ColonColonToken) 7254Debug.Assert(this.CurrentToken.Kind is SyntaxKind.IdentifierToken); 7257isAlias = this.PeekToken(1).Kind == SyntaxKind.ColonColonToken; 7300else if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 7305if (result == ScanTypeFlags.NotType || mode == ParseTypeMode.DefinitePattern && this.CurrentToken.Kind != SyntaxKind.OpenBracketToken) 7327case SyntaxKind.QuestionToken 7328when lastTokenOfType.Kind is not SyntaxKind.QuestionToken // don't allow `Type??` 7329and not SyntaxKind.AsteriskToken: // don't allow `Type*?` 7333case SyntaxKind.AsteriskToken: 7363case SyntaxKind.OpenBracketToken: 7366while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7371if (this.CurrentToken.Kind != SyntaxKind.CloseBracketToken) 7404if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7422while (this.CurrentToken.Kind == SyntaxKind.CommaToken); 7424if (this.CurrentToken.Kind == SyntaxKind.CloseParenToken) 7441_ = EatToken(SyntaxKind.DelegateKeyword); 7442lastTokenOfType = EatToken(SyntaxKind.AsteriskToken); 7446if (CurrentToken.Kind == SyntaxKind.IdentifierToken) 7451case { ContextualKind: SyntaxKind.ManagedKeyword }: 7452case { ContextualKind: SyntaxKind.UnmanagedKeyword }: 7454case var _ when peek1.Kind == SyntaxKind.OpenBracketToken: 7464if (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 7466lastTokenOfType = EatToken(SyntaxKind.OpenBracketToken); 7474lastTokenOfType = TryEatToken(SyntaxKind.IdentifierToken) ?? lastTokenOfType; 7481Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 7485lastTokenOfType = TryEatToken(SyntaxKind.CloseBracketToken) ?? lastTokenOfType; 7504var validStartingToken = EatToken().Kind == SyntaxKind.LessThanToken; 7524_ = EatToken(SyntaxKind.CommaToken); 7534if (!validStartingToken && CurrentToken.Kind == SyntaxKind.CloseParenToken) 7536lastTokenOfType = EatTokenAsKind(SyntaxKind.GreaterThanToken); 7540lastTokenOfType = EatToken(SyntaxKind.GreaterThanToken); 7548isNotExpectedFunction: static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 7550expected: SyntaxKind.CommaToken, 7551closeKind: SyntaxKind.None, 7557private static bool IsPredefinedType(SyntaxKind keyword) 7569if (this.CurrentToken.Kind == SyntaxKind.VoidKeyword && this.PeekToken(1).Kind != SyntaxKind.AsteriskToken) 7594if (this.CurrentToken.Kind == SyntaxKind.RefKeyword) 7598this.CurrentToken.Kind == SyntaxKind.ReadOnlyKeyword ? this.EatToken() : null, 7644case SyntaxKind.QuestionToken: 7656case SyntaxKind.AsteriskToken: 7682case SyntaxKind.OpenBracketToken: 7690while (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken); 7711Debug.Assert(this.CurrentToken.Kind == SyntaxKind.QuestionToken); 7717if (typeParsedSoFar.Kind is SyntaxKind.NullableType or SyntaxKind.PointerType) 7734if (mode == ParseTypeMode.AfterIs && this.CurrentToken.Kind is SyntaxKind.OpenBracketToken) 7747case SyntaxKind.CommaToken: 7753case SyntaxKind.CloseBracketToken: 7761return this.CurrentToken.Kind != SyntaxKind.ColonToken; 7797if (this.CurrentToken.ContextualKind is SyntaxKind.AsyncKeyword or SyntaxKind.AwaitKeyword or SyntaxKind.FromKeyword) 7803if (nextToken.ContextualKind == SyntaxKind.WithKeyword) 7806var nextTokenKind = nextToken.Kind; 7823if (nextTokenKind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken or SyntaxKind.CloseBraceToken) 7828if (nextTokenKind == SyntaxKind.OpenBraceToken) 7833if (nextTokenKind == SyntaxKind.CommaToken) 7837if (nextTokenKind == SyntaxKind.SemicolonToken) 7842if (nextTokenKind == SyntaxKind.EndOfFileToken) 7851if (this.CurrentToken.Kind is SyntaxKind.OpenBracketToken) 7860this.CurrentToken.Kind is SyntaxKind.OpenParenToken or // ctor parameters 7861SyntaxKind.OpenBracketToken or // array type 7862SyntaxKind.OpenBraceToken; // object initializer 7876case SyntaxKind.AsteriskToken: 7878case SyntaxKind.OpenBracketToken: 7890var open = this.EatToken(SyntaxKind.OpenBracketToken); 7893var omittedArraySizeExpressionInstance = _syntaxFactory.OmittedArraySizeExpression(SyntaxFactory.Token(SyntaxKind.OmittedArraySizeExpressionToken)); 7895while (IsMakingProgress(ref lastTokenPosition) && this.CurrentToken.Kind != SyntaxKind.CloseBracketToken) 7897if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7910if (this.CurrentToken.Kind != SyntaxKind.CloseBracketToken) 7912list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 7915else if (this.SkipBadArrayRankSpecifierTokens(ref open, list, SyntaxKind.CommaToken) == PostSkipAction.Abort) 7935if (list[i].RawKind == (int)SyntaxKind.OmittedArraySizeExpression) 7943this.EatToken(SyntaxKind.CloseBracketToken)); 7948var open = this.EatToken(SyntaxKind.OpenParenToken); 7951if (this.CurrentToken.Kind != SyntaxKind.CloseParenToken) 7955while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 7957list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 7969list.AddSeparator(SyntaxFactory.MissingToken(SyntaxKind.CommaToken)); 7977this.EatToken(SyntaxKind.CloseParenToken)); 7987private PostSkipAction SkipBadArrayRankSpecifierTokens(ref SyntaxToken openBracket, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expected) 7990static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleExpression(), 7991static (p, _) => p.CurrentToken.Kind == SyntaxKind.CloseBracketToken, 8001if (token.Kind == SyntaxKind.VoidKeyword && this.CurrentToken.Kind != SyntaxKind.AsteriskToken) 8010if (IsTrueIdentifier() || this.CurrentToken.Kind == SyntaxKind.ColonColonToken) 8015if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 8033var @delegate = EatToken(SyntaxKind.DelegateKeyword); 8034var asterisk = EatToken(SyntaxKind.AsteriskToken); 8040var lessThanTokenError = CreateMissingToken(SyntaxKind.LessThanToken, SyntaxKind.None); 8055TryEatToken(SyntaxKind.GreaterThanToken) ?? SyntaxFactory.MissingToken(SyntaxKind.GreaterThanToken))); 8058var lessThanToken = EatTokenAsKind(SyntaxKind.LessThanToken); 8081Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 8082types.AddSeparator(EatToken(SyntaxKind.CommaToken)); 8092lessThanToken.IsMissing && CurrentToken.Kind == SyntaxKind.CloseParenToken 8093? EatTokenAsKind(SyntaxKind.GreaterThanToken) 8094: EatToken(SyntaxKind.GreaterThanToken))); 8107isNotExpectedFunction: static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 8110expected: SyntaxKind.CommaToken); 8115if (CurrentToken.Kind == SyntaxKind.IdentifierToken) 8121case { ContextualKind: SyntaxKind.ManagedKeyword }: 8122case { ContextualKind: SyntaxKind.UnmanagedKeyword }: 8128managedSpecifier = EatTokenAsKind(SyntaxKind.ManagedKeyword); 8131case var _ when peek1.Kind == SyntaxKind.OpenBracketToken: 8133managedSpecifier = EatTokenAsKind(SyntaxKind.UnmanagedKeyword); 8143if (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 8145var openBracket = EatToken(SyntaxKind.OpenBracketToken); 8154callingConventionModifiers.Add(SyntaxFactory.FunctionPointerUnmanagedCallingConvention(EatToken(SyntaxKind.IdentifierToken))); 8161Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 8162callingConventionModifiers.AddSeparator(EatToken(SyntaxKind.CommaToken)); 8165var closeBracket = EatToken(SyntaxKind.CloseBracketToken); 8177if (managedSpecifier.Kind == SyntaxKind.ManagedKeyword && unmanagedCallingConventions != null) 8191=> CurrentToken.Kind == SyntaxKind.DelegateKeyword && PeekToken(1).Kind == SyntaxKind.AsteriskToken; 8196=> token.Kind == SyntaxKind.LessThanToken || token.Kind == SyntaxKind.OpenParenToken; 8202while (this.CurrentToken.Kind == SyntaxKind.AsteriskToken) 8214static @this => SyntaxFactory.EmptyStatement(attributeLists: default, SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken))); 8222if (this.CurrentToken.Kind != SyntaxKind.OpenBracketToken) 8236while (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 8247is SyntaxKind.DotToken 8248or SyntaxKind.QuestionToken 8249or SyntaxKind.ExclamationToken 8250or SyntaxKind.PlusPlusToken 8251or SyntaxKind.MinusMinusToken 8252or SyntaxKind.MinusGreaterThanToken; 8261|| (this.CurrentToken.ContextualKind is SyntaxKind.SwitchKeyword or SyntaxKind.WithKeyword && this.PeekToken(1).Kind is SyntaxKind.OpenBraceToken); 8265this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 8326case SyntaxKind.FixedKeyword: 8328case SyntaxKind.BreakKeyword: 8330case SyntaxKind.ContinueKeyword: 8332case SyntaxKind.TryKeyword: 8333case SyntaxKind.CatchKeyword: 8334case SyntaxKind.FinallyKeyword: 8336case SyntaxKind.CheckedKeyword: 8337case SyntaxKind.UncheckedKeyword: 8339case SyntaxKind.DoKeyword: 8341case SyntaxKind.ForKeyword: 8343case SyntaxKind.ForEachKeyword: 8345case SyntaxKind.GotoKeyword: 8347case SyntaxKind.IfKeyword: 8349case SyntaxKind.ElseKeyword: 8352case SyntaxKind.LockKeyword: 8354case SyntaxKind.ReturnKeyword: 8356case SyntaxKind.SwitchKeyword: 8357case SyntaxKind.CaseKeyword: // error recovery case. 8359case SyntaxKind.ThrowKeyword: 8361case SyntaxKind.UnsafeKeyword: 8366case SyntaxKind.UsingKeyword: 8368case SyntaxKind.WhileKeyword: 8370case SyntaxKind.OpenBraceToken: 8372case SyntaxKind.SemicolonToken: 8374case SyntaxKind.IdentifierToken: 8420bool beginsWithAwait = this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword; 8455if (this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword && 8456this.PeekToken(1).Kind == SyntaxKind.ForEachKeyword) 8458return this.ParseForEachStatement(attributes, this.EatContextualToken(SyntaxKind.AwaitKeyword)); 8462if (PeekToken(2).Kind == SyntaxKind.OpenParenToken) 8465return this.ParseUsingStatement(attributes, this.EatContextualToken(SyntaxKind.AwaitKeyword)); 8489=> PeekToken(1).Kind == SyntaxKind.OpenParenToken ? ParseUsingStatement(attributes) : ParseLocalDeclarationStatement(attributes); 8496=> CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword && PeekToken(1).Kind == SyntaxKind.UsingKeyword; 8500return this.PeekToken(1).Kind == SyntaxKind.ColonToken && this.IsTrueIdentifier(); 8505return this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken; 8510return this.CurrentToken.ContextualKind == SyntaxKind.YieldKeyword && 8511this.PeekToken(1).Kind is SyntaxKind.ReturnKeyword or SyntaxKind.BreakKeyword; 8520var tk = this.CurrentToken.Kind; 8521if (tk == SyntaxKind.RefKeyword || 8524this.PeekToken(1).Kind is not SyntaxKind.DotToken // e.g. `int.Parse()` is an expression 8525and not SyntaxKind.OpenParenToken)) // e.g. `int (x, y)` is an error decl expression 8531if (tk == SyntaxKind.UsingKeyword) 8533Debug.Assert(PeekToken(1).Kind != SyntaxKind.OpenParenToken); 8539Debug.Assert(PeekToken(2).Kind != SyntaxKind.OpenParenToken); 8552&& (tk is not (SyntaxKind.AsyncKeyword or SyntaxKind.ScopedKeyword) || ShouldContextualKeywordBeTreatedAsModifier(parsingStatementNotDeclaration: true)); 8584var tk = this.CurrentToken.ContextualKind; 8586if (tk == SyntaxKind.IdentifierToken) 8589if (token1.Kind == SyntaxKind.DotToken && 8590token1.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia)) 8592if (PeekToken(2).Kind == SyntaxKind.IdentifierToken && 8593PeekToken(3).Kind == SyntaxKind.IdentifierToken) 8608var token4Kind = PeekToken(4).Kind; 8609if (token4Kind != SyntaxKind.SemicolonToken && 8610token4Kind != SyntaxKind.EqualsToken && 8611token4Kind != SyntaxKind.CommaToken && 8612token4Kind != SyntaxKind.OpenParenToken && 8613token4Kind != SyntaxKind.LessThanToken) 8628if (st == ScanTypeFlags.MustBeType && this.CurrentToken.Kind is not SyntaxKind.DotToken and not SyntaxKind.OpenParenToken) 8638if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 8667if (this.CurrentToken.Kind != SyntaxKind.UsingKeyword) 8672var tk = PeekToken(1).Kind; 8674if (tk == SyntaxKind.RefKeyword) 8681if (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. 8701if (tk == SyntaxKind.StaticKeyword) 8733if (this.CurrentToken.Kind is SyntaxKind.OpenBraceToken) 8739if (identifierOrThisOpt.Kind == SyntaxKind.ThisKeyword) 8754if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 8761if (this.CurrentToken.Kind == SyntaxKind.EqualsToken) 8770return this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.SemicolonToken; 8788if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken || this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 8795if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 8820if (parameter.Modifiers[i].Kind == SyntaxKind.ParamsKeyword) 8830if (parameter.Identifier.Kind == SyntaxKind.ArgListKeyword) 8835else if (parameter.Type.Kind == SyntaxKind.NullableType) 8855else if (parameter.Type.Kind == SyntaxKind.IdentifierName && 8856((IdentifierNameSyntax)parameter.Type).Identifier.ContextualKind == SyntaxKind.FromKeyword) 8887Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DelegateKeyword); 8892if (nextToken.Kind == SyntaxKind.OpenBraceToken) 8898if (nextToken.Kind != SyntaxKind.OpenParenToken) 8915Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenParenToken); 8924if (scanResult == ScanTypeFlags.TupleType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 8935Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NewKeyword); 8944case SyntaxKind.OpenBraceToken: 8945case SyntaxKind.OpenBracketToken: 8970if (SyntaxFacts.GetBaseTypeDeclarationKind(nextToken.Kind) != SyntaxKind.None) 9026case SyntaxKind.DotToken: 9027case SyntaxKind.AsteriskToken: 9028case SyntaxKind.QuestionToken: 9029case SyntaxKind.OpenBracketToken: 9030case SyntaxKind.LessThanToken: 9031case SyntaxKind.ColonColonToken: 9034case SyntaxKind.OpenParenToken: 9046case SyntaxKind.IdentifierToken: 9049case SyntaxKind.ThisKeyword: 9073this.CurrentNodeKind == SyntaxKind.Block && 9080CSharpSyntaxNode openBrace = isAccessorBody && this.CurrentToken.Kind != SyntaxKind.OpenBraceToken 9082SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken), 9086: this.EatToken(SyntaxKind.OpenBraceToken); 9098this.EatToken(SyntaxKind.CloseBraceToken)); 9114if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.Block && attributes.Count == 0) 9117CSharpSyntaxNode openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 9126this.EatToken(SyntaxKind.CloseBraceToken)); 9161while (this.CurrentToken.Kind is not SyntaxKind.CloseBraceToken and not SyntaxKind.EndOfFileToken 9176var action = this.SkipBadStatementListTokens(statements, SyntaxKind.CloseBraceToken, out trailingTrivia); 9193return this.CurrentToken.Kind == SyntaxKind.SemicolonToken 9197private PostSkipAction SkipBadStatementListTokens(SyntaxListBuilder<StatementSyntax> statements, SyntaxKind expected, out GreenNode trailingTrivia) 9205static (p, _) => p.CurrentToken.Kind == SyntaxKind.CloseBraceToken, 9207closeKind: SyntaxKind.None, 9213var tk = this.CurrentToken.Kind; 9217case SyntaxKind.FixedKeyword: 9218case SyntaxKind.BreakKeyword: 9219case SyntaxKind.ContinueKeyword: 9220case SyntaxKind.TryKeyword: 9221case SyntaxKind.ConstKeyword: 9222case SyntaxKind.DoKeyword: 9223case SyntaxKind.ForKeyword: 9224case SyntaxKind.ForEachKeyword: 9225case SyntaxKind.GotoKeyword: 9226case SyntaxKind.IfKeyword: 9227case SyntaxKind.ElseKeyword: 9228case SyntaxKind.LockKeyword: 9229case SyntaxKind.ReturnKeyword: 9230case SyntaxKind.UnsafeKeyword: 9231case SyntaxKind.UsingKeyword: 9232case SyntaxKind.WhileKeyword: 9233case SyntaxKind.VolatileKeyword: 9234case SyntaxKind.ExternKeyword: 9235case SyntaxKind.CaseKeyword: // for parsing an errant case without a switch. 9250var tk = this.CurrentToken.Kind; 9253case SyntaxKind.CheckedKeyword: 9254case SyntaxKind.UncheckedKeyword: 9255case SyntaxKind.ThrowKeyword: 9256case SyntaxKind.SwitchKeyword: 9257case SyntaxKind.OpenBraceToken: 9258case SyntaxKind.SemicolonToken: 9259case SyntaxKind.StaticKeyword: 9260case SyntaxKind.ReadOnlyKeyword: 9261case SyntaxKind.RefKeyword: 9262case SyntaxKind.OpenBracketToken: 9265case SyntaxKind.IdentifierToken: 9276var @fixed = this.EatToken(SyntaxKind.FixedKeyword); 9277var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9289this.EatToken(SyntaxKind.CloseParenToken), 9295return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.OpenBraceToken or SyntaxKind.SemicolonToken; 9315return SyntaxFactory.EmptyStatement(attributeLists: default, EatToken(SyntaxKind.SemicolonToken)); 9321if (statement.Kind == SyntaxKind.ExpressionStatement && 9344this.EatToken(SyntaxKind.BreakKeyword), 9345this.EatToken(SyntaxKind.SemicolonToken)); 9352this.EatToken(SyntaxKind.ContinueKeyword), 9353this.EatToken(SyntaxKind.SemicolonToken)); 9358Debug.Assert(this.CurrentToken.Kind is SyntaxKind.TryKeyword or SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword); 9361var @try = this.EatToken(SyntaxKind.TryKeyword); 9371Debug.Assert(this.CurrentToken.Kind is SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword); 9385if (this.CurrentToken.Kind == SyntaxKind.CatchKeyword) 9388while (this.CurrentToken.Kind == SyntaxKind.CatchKeyword) 9394if (this.CurrentToken.Kind == SyntaxKind.FinallyKeyword) 9408SyntaxFactory.MissingToken(SyntaxKind.FinallyKeyword), 9422SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken), 9424SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken)); 9429return this.CurrentToken.Kind is SyntaxKind.CloseBraceToken or SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword; 9434Debug.Assert(this.CurrentToken.Kind == SyntaxKind.CatchKeyword); 9441if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 9455var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9461var keywordKind = this.CurrentToken.ContextualKind; 9462if (keywordKind == SyntaxKind.WhenKeyword || keywordKind == SyntaxKind.IfKeyword) 9464var whenKeyword = this.EatContextualToken(SyntaxKind.WhenKeyword); 9465if (keywordKind == SyntaxKind.IfKeyword) 9476var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9480var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9493return this.CurrentToken.Kind is SyntaxKind.CloseParenToken 9494or SyntaxKind.OpenBraceToken 9495or SyntaxKind.CloseBraceToken 9496or SyntaxKind.CatchKeyword 9497or SyntaxKind.FinallyKeyword; 9502return this.CurrentToken.Kind is SyntaxKind.CloseParenToken 9503or SyntaxKind.OpenBraceToken 9504or SyntaxKind.CloseBraceToken 9505or SyntaxKind.CatchKeyword 9506or SyntaxKind.FinallyKeyword; 9510return this.CurrentToken.Kind is SyntaxKind.CloseBraceToken 9511or SyntaxKind.CatchKeyword 9512or SyntaxKind.FinallyKeyword; 9517Debug.Assert(this.CurrentToken.Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword); 9519if (this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 9534Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DoKeyword); 9535var @do = this.EatToken(SyntaxKind.DoKeyword); 9537var @while = this.EatToken(SyntaxKind.WhileKeyword); 9538var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9552this.EatToken(SyntaxKind.CloseParenToken), 9553this.EatToken(SyntaxKind.SemicolonToken)); 9558return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken; 9575Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9577if (this.EatToken().Kind == SyntaxKind.OpenParenToken && 9579this.EatToken().Kind == SyntaxKind.IdentifierToken && 9580this.EatToken().Kind == SyntaxKind.InKeyword) 9596Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9601var forToken = this.EatToken(SyntaxKind.ForKeyword); 9602var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9606var condition = this.CurrentToken.Kind is not SyntaxKind.SemicolonToken and not SyntaxKind.CommaToken 9615var incrementors = this.CurrentToken.Kind != SyntaxKind.CloseParenToken 9644if (this.CurrentToken.ContextualKind == SyntaxKind.ScopedKeyword) 9646if (this.PeekToken(1).Kind == SyntaxKind.RefKeyword) 9653isDeclaration = ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken; 9657else if (this.CurrentToken.Kind == SyntaxKind.RefKeyword) 9674else if (this.CurrentToken.Kind != SyntaxKind.SemicolonToken) 9689=> this.CurrentToken.Kind is SyntaxKind.CommaToken 9690? this.EatTokenAsKind(SyntaxKind.SemicolonToken) 9691: this.EatToken(SyntaxKind.SemicolonToken); 9697while (this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.CommaToken) 9698skippedTokens.Add(this.EatTokenEvenWithIncorrectKind(SyntaxKind.CloseParenToken)); 9700var result = this.EatToken(SyntaxKind.CloseParenToken); 9710SyntaxKind.CloseParenToken, 9719LanguageParser @this, ref SyntaxToken startToken, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 9721if (@this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken) 9725static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleExpression(), 9726static (p, closeKind) => p.CurrentToken.Kind == closeKind || p.CurrentToken.Kind == SyntaxKind.SemicolonToken, 9733return this.CurrentToken.Kind is SyntaxKind.SemicolonToken or SyntaxKind.CloseParenToken or SyntaxKind.OpenBraceToken; 9740Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForEachKeyword || this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9751if (this.CurrentToken.Kind == SyntaxKind.ForKeyword) 9754skippedForToken = this.AddError(skippedForToken, ErrorCode.ERR_SyntaxError, SyntaxFacts.GetText(SyntaxKind.ForEachKeyword)); 9755@foreach = ConvertToMissingWithTrailingTrivia(skippedForToken, SyntaxKind.ForEachKeyword); 9759@foreach = this.EatToken(SyntaxKind.ForEachKeyword); 9762var openParen = this.EatToken(SyntaxKind.OpenParenToken); 9765var @in = this.EatToken(SyntaxKind.InKeyword, ErrorCode.ERR_InExpected); 9772var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 9777if (decl.designation.Kind != SyntaxKind.ParenthesizedVariableDesignation) 9783case SyntaxKind.SingleVariableDesignation: 9786case SyntaxKind.DiscardDesignation: 9789Debug.Assert(discard.Kind == SyntaxKind.UnderscoreToken); 9790identifier = SyntaxToken.WithValue(SyntaxKind.IdentifierToken, discard.LeadingTrivia.Node, discard.Text, discard.ValueText, discard.TrailingTrivia.Node); 9845if (this.IsInAsync && this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword) 9853if (this.CurrentToken.ContextualKind == SyntaxKind.ScopedKeyword) 9856if (ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 9861if (this.PeekToken(1).Kind == SyntaxKind.CommaToken) 9869if (this.PeekToken(1).Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken) 9903return this.CurrentToken.Kind == SyntaxKind.CommaToken; 9905return this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.CloseParenToken; 9925case SyntaxKind.DotToken: 9926case SyntaxKind.ColonColonToken: 9927case SyntaxKind.OpenBracketToken: 9928case SyntaxKind.AsteriskToken: 9929case SyntaxKind.QuestionToken: 9930case SyntaxKind.LessThanToken: 9941case SyntaxKind.DeclarationExpression: 9944case SyntaxKind.TupleExpression: 9947case SyntaxKind.IdentifierName: 9949return ((IdentifierNameSyntax)variable).Identifier.ContextualKind == SyntaxKind.UnderscoreToken; 9957Debug.Assert(this.CurrentToken.Kind == SyntaxKind.GotoKeyword); 9959var @goto = this.EatToken(SyntaxKind.GotoKeyword); 9963SyntaxKind kind; 9965if (this.CurrentToken.Kind is SyntaxKind.CaseKeyword or SyntaxKind.DefaultKeyword) 9968if (caseOrDefault.Kind == SyntaxKind.CaseKeyword) 9970kind = SyntaxKind.GotoCaseStatement; 9975kind = SyntaxKind.GotoDefaultStatement; 9980kind = SyntaxKind.GotoStatement; 9985kind, attributes, @goto, caseOrDefault, arg, this.EatToken(SyntaxKind.SemicolonToken)); 9993if (this.CurrentToken.Kind != SyntaxKind.CloseParenToken) 10004if (this.CurrentToken.Kind == SyntaxKind.CloseParenToken && 10005this.PeekToken(1).Kind != SyntaxKind.EqualsGreaterThanToken && 10023Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IfKeyword); 10030var ifKeyword = this.EatToken(SyntaxKind.IfKeyword); 10031var openParen = this.EatToken(SyntaxKind.OpenParenToken); 10033var closeParen = this.EatToken(SyntaxKind.CloseParenToken); 10036var elseKeyword = this.CurrentToken.Kind != SyntaxKind.ElseKeyword ? 10038this.EatToken(SyntaxKind.ElseKeyword); 10047if (this.CurrentToken.Kind != SyntaxKind.IfKeyword) 10088Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ElseKeyword); 10092this.EatToken(SyntaxKind.IfKeyword, ErrorCode.ERR_ElseCannotStartStatement), 10093this.EatToken(SyntaxKind.OpenParenToken), 10095this.EatToken(SyntaxKind.CloseParenToken), 10102return this.CurrentToken.Kind != SyntaxKind.ElseKeyword 10105this.EatToken(SyntaxKind.ElseKeyword), 10111Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LockKeyword); 10114this.EatToken(SyntaxKind.LockKeyword), 10115this.EatToken(SyntaxKind.OpenParenToken), 10117this.EatToken(SyntaxKind.CloseParenToken), 10123Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ReturnKeyword); 10126this.EatToken(SyntaxKind.ReturnKeyword), 10127this.CurrentToken.Kind != SyntaxKind.SemicolonToken ? this.ParsePossibleRefExpression() : null, 10128this.EatToken(SyntaxKind.SemicolonToken)); 10133Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.YieldKeyword); 10138SyntaxKind kind; 10140if (this.CurrentToken.Kind == SyntaxKind.BreakKeyword) 10142kind = SyntaxKind.YieldBreakStatement; 10147kind = SyntaxKind.YieldReturnStatement; 10148returnOrBreak = this.EatToken(SyntaxKind.ReturnKeyword); 10149if (this.CurrentToken.Kind == SyntaxKind.SemicolonToken) 10165this.EatToken(SyntaxKind.SemicolonToken)); 10170Debug.Assert(this.CurrentToken.Kind is SyntaxKind.SwitchKeyword or SyntaxKind.CaseKeyword); 10186this.EatToken(SyntaxKind.CloseBraceToken)); 10195if (this.CurrentToken.Kind is SyntaxKind.CaseKeyword) 10199switchKeyword = EatToken(SyntaxKind.SwitchKeyword); 10200openParen = SyntaxFactory.MissingToken(SyntaxKind.OpenParenToken); 10202closeParen = SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken); 10203openBrace = SyntaxFactory.MissingToken(SyntaxKind.OpenBraceToken); 10207switchKeyword = this.EatToken(SyntaxKind.SwitchKeyword); 10209if (expression.Kind == SyntaxKind.ParenthesizedExpression) 10218else if (expression.Kind == SyntaxKind.TupleExpression) 10228openParen = SyntaxFactory.MissingToken(SyntaxKind.OpenParenToken); 10230closeParen = SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken); 10233openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 10240return this.CurrentToken.Kind == SyntaxKind.CaseKeyword || 10241(this.CurrentToken.Kind == SyntaxKind.DefaultKeyword && this.PeekToken(1).Kind != SyntaxKind.OpenParenToken); 10255if (this.CurrentToken.Kind == SyntaxKind.CaseKeyword) 10259if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 10264this.EatToken(SyntaxKind.ColonToken)); 10271if (this.CurrentToken.ContextualKind == SyntaxKind.WhenKeyword && node is ExpressionSyntax ex) 10274if (node.Kind == SyntaxKind.DiscardPattern) 10283this.EatToken(SyntaxKind.ColonToken)); 10290this.EatToken(SyntaxKind.ColonToken)); 10296Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DefaultKeyword); 10298this.EatToken(SyntaxKind.DefaultKeyword), 10299this.EatToken(SyntaxKind.ColonToken)); 10318Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ThrowKeyword); 10321this.EatToken(SyntaxKind.ThrowKeyword), 10322this.CurrentToken.Kind != SyntaxKind.SemicolonToken ? this.ParseExpressionCore() : null, 10323this.EatToken(SyntaxKind.SemicolonToken)); 10328Debug.Assert(this.CurrentToken.Kind == SyntaxKind.UnsafeKeyword); 10331this.EatToken(SyntaxKind.UnsafeKeyword), 10337var @using = this.EatToken(SyntaxKind.UsingKeyword); 10338var openParen = this.EatToken(SyntaxKind.OpenParenToken); 10354this.EatToken(SyntaxKind.CloseParenToken), 10396if (this.CurrentToken.Kind != SyntaxKind.IdentifierToken) 10410case SyntaxKind.CommaToken: 10411case SyntaxKind.CloseParenToken: 10416case SyntaxKind.EqualsToken: 10423if (this.CurrentToken.Kind == SyntaxKind.ColonToken && 10424declaration.Type.Kind == SyntaxKind.NullableType && 10455bool condition1 = st == ScanTypeFlags.MustBeType && this.CurrentToken.Kind != SyntaxKind.DotToken; 10456bool condition2 = st != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken; 10457bool condition3 = st == ScanTypeFlags.NonGenericTypeOrExpression || this.PeekToken(1).Kind == SyntaxKind.EqualsToken; 10464Debug.Assert(this.CurrentToken.Kind == SyntaxKind.WhileKeyword); 10467this.EatToken(SyntaxKind.WhileKeyword), 10468this.EatToken(SyntaxKind.OpenParenToken), 10470this.EatToken(SyntaxKind.CloseParenToken), 10478Debug.Assert(this.IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.ColonToken); 10483this.EatToken(SyntaxKind.ColonToken), 10484this.ParsePossiblyAttributedStatement() ?? SyntaxFactory.EmptyStatement(attributeLists: default, EatToken(SyntaxKind.SemicolonToken))); 10496awaitKeyword = this.EatContextualToken(SyntaxKind.AwaitKeyword); 10499else if (this.CurrentToken.Kind == SyntaxKind.UsingKeyword) 10582this.EatToken(SyntaxKind.SemicolonToken)); 10595if (this.CurrentToken.ContextualKind != SyntaxKind.ScopedKeyword) 10607var scopedKeyword = this.EatContextualToken(SyntaxKind.ScopedKeyword); 10629return this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.GreaterThanToken; 10631else if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 10645? this.EatContextualToken(SyntaxKind.ScopedKeyword) 10656if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 10658var openParen = this.EatToken(SyntaxKind.OpenParenToken); 10664done = (this.CurrentToken.Kind == SyntaxKind.CloseParenToken); 10669listOfDesignations.AddSeparator(EatToken(SyntaxKind.CommaToken)); 10677if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 10679listOfDesignations.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 10691this.EatToken(SyntaxKind.CloseParenToken)); 10707return CurrentToken.ContextualKind == SyntaxKind.UnderscoreToken 10708? _syntaxFactory.DiscardDesignation(this.EatContextualToken(SyntaxKind.UnderscoreToken)) 10709: _syntaxFactory.SingleVariableDesignation(this.EatToken(SyntaxKind.IdentifierToken)); 10714if (this.CurrentToken.ContextualKind != SyntaxKind.WhenKeyword) 10720this.EatContextualToken(SyntaxKind.WhenKeyword), 10769if (mods.Any((int)SyntaxKind.ConstKeyword)) 10788if (allowLocalFunctions && localFunction == null && type is PredefinedTypeSyntax { Keyword.Kind: SyntaxKind.VoidKeyword }) 10800case SyntaxKind.SemicolonToken: 10801case SyntaxKind.ColonToken: 10810SyntaxKind k; 10814if (k == SyntaxKind.AsyncKeyword) 10833else if (k is SyntaxKind.ReadOnlyKeyword or SyntaxKind.VolatileKeyword) 10848Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IdentifierToken); 10862if (ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 10876private static bool IsDeclarationModifier(SyntaxKind kind) 10880case SyntaxKind.ConstKeyword: 10881case SyntaxKind.StaticKeyword: 10882case SyntaxKind.ReadOnlyKeyword: 10883case SyntaxKind.VolatileKeyword: 10890private static bool IsAdditionalLocalFunctionModifier(SyntaxKind kind) 10894case SyntaxKind.StaticKeyword: 10895case SyntaxKind.AsyncKeyword: 10896case SyntaxKind.UnsafeKeyword: 10897case SyntaxKind.ExternKeyword: 10900case SyntaxKind.PublicKeyword: 10901case SyntaxKind.InternalKeyword: 10902case SyntaxKind.ProtectedKeyword: 10903case SyntaxKind.PrivateKeyword: 10911private static bool IsAccessibilityModifier(SyntaxKind kind) 10917case SyntaxKind.PublicKeyword: 10918case SyntaxKind.InternalKeyword: 10919case SyntaxKind.ProtectedKeyword: 10920case SyntaxKind.PrivateKeyword: 10946if (type.Kind == SyntaxKind.IdentifierName) 10949forceLocalFunc = id.ContextualKind != SyntaxKind.AwaitKeyword; 10958case SyntaxKind.AsyncKeyword: 10961case SyntaxKind.UnsafeKeyword: 10964case SyntaxKind.ReadOnlyKeyword: 10965case SyntaxKind.VolatileKeyword: 10967case SyntaxKind.StaticKeyword: 10969case SyntaxKind.ExternKeyword: 10991using var _ = new ParserSyntaxContextResetter(this, isInAsyncContext: modifiers.Any((int)SyntaxKind.AsyncKeyword)); 11010if (this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword) 11049if (IsScript && this.CurrentToken.Kind == SyntaxKind.EndOfFileToken) 11051semicolon = SyntaxFactory.MissingToken(SyntaxKind.SemicolonToken); 11057semicolon = this.EatToken(SyntaxKind.SemicolonToken); 11093SyntaxKind tk = this.CurrentToken.Kind; 11096case SyntaxKind.TypeOfKeyword: 11097case SyntaxKind.DefaultKeyword: 11098case SyntaxKind.SizeOfKeyword: 11099case SyntaxKind.MakeRefKeyword: 11100case SyntaxKind.RefTypeKeyword: 11101case SyntaxKind.CheckedKeyword: 11102case SyntaxKind.UncheckedKeyword: 11103case SyntaxKind.RefValueKeyword: 11104case SyntaxKind.ArgListKeyword: 11105case SyntaxKind.BaseKeyword: 11106case SyntaxKind.FalseKeyword: 11107case SyntaxKind.ThisKeyword: 11108case SyntaxKind.TrueKeyword: 11109case SyntaxKind.NullKeyword: 11110case SyntaxKind.OpenParenToken: 11111case SyntaxKind.NumericLiteralToken: 11112case SyntaxKind.StringLiteralToken: 11113case SyntaxKind.Utf8StringLiteralToken: 11114case SyntaxKind.SingleLineRawStringLiteralToken: 11115case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 11116case SyntaxKind.MultiLineRawStringLiteralToken: 11117case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 11118case SyntaxKind.InterpolatedStringToken: 11119case SyntaxKind.InterpolatedStringStartToken: 11120case SyntaxKind.InterpolatedVerbatimStringStartToken: 11121case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 11122case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 11123case SyntaxKind.CharacterLiteralToken: 11124case SyntaxKind.NewKeyword: 11125case SyntaxKind.DelegateKeyword: 11126case SyntaxKind.ColonColonToken: // bad aliased name 11127case SyntaxKind.ThrowKeyword: 11128case SyntaxKind.StackAllocKeyword: 11129case SyntaxKind.RefKeyword: 11130case SyntaxKind.OpenBracketToken: // attributes on a lambda, or a collection expression. 11132case SyntaxKind.DotToken when IsAtDotDotToken(): 11134case SyntaxKind.StaticKeyword: 11136case SyntaxKind.IdentifierToken: 11139return this.IsTrueIdentifier() || this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword; 11148private static bool IsInvalidSubExpression(SyntaxKind kind) 11152case SyntaxKind.BreakKeyword: 11153case SyntaxKind.CaseKeyword: 11154case SyntaxKind.CatchKeyword: 11155case SyntaxKind.ConstKeyword: 11156case SyntaxKind.ContinueKeyword: 11157case SyntaxKind.DoKeyword: 11158case SyntaxKind.FinallyKeyword: 11159case SyntaxKind.ForKeyword: 11160case SyntaxKind.ForEachKeyword: 11161case SyntaxKind.GotoKeyword: 11162case SyntaxKind.IfKeyword: 11163case SyntaxKind.ElseKeyword: 11164case SyntaxKind.LockKeyword: 11165case SyntaxKind.ReturnKeyword: 11166case SyntaxKind.SwitchKeyword: 11167case SyntaxKind.TryKeyword: 11168case SyntaxKind.UsingKeyword: 11169case SyntaxKind.WhileKeyword: 11176internal static bool IsRightAssociative(SyntaxKind op) 11180case SyntaxKind.SimpleAssignmentExpression: 11181case SyntaxKind.AddAssignmentExpression: 11182case SyntaxKind.SubtractAssignmentExpression: 11183case SyntaxKind.MultiplyAssignmentExpression: 11184case SyntaxKind.DivideAssignmentExpression: 11185case SyntaxKind.ModuloAssignmentExpression: 11186case SyntaxKind.AndAssignmentExpression: 11187case SyntaxKind.ExclusiveOrAssignmentExpression: 11188case SyntaxKind.OrAssignmentExpression: 11189case SyntaxKind.LeftShiftAssignmentExpression: 11190case SyntaxKind.RightShiftAssignmentExpression: 11191case SyntaxKind.UnsignedRightShiftAssignmentExpression: 11192case SyntaxKind.CoalesceAssignmentExpression: 11193case SyntaxKind.CoalesceExpression: 11226private static Precedence GetPrecedence(SyntaxKind op) 11230case SyntaxKind.QueryExpression: 11232case SyntaxKind.ParenthesizedLambdaExpression: 11233case SyntaxKind.SimpleLambdaExpression: 11234case SyntaxKind.AnonymousMethodExpression: 11236case SyntaxKind.SimpleAssignmentExpression: 11237case SyntaxKind.AddAssignmentExpression: 11238case SyntaxKind.SubtractAssignmentExpression: 11239case SyntaxKind.MultiplyAssignmentExpression: 11240case SyntaxKind.DivideAssignmentExpression: 11241case SyntaxKind.ModuloAssignmentExpression: 11242case SyntaxKind.AndAssignmentExpression: 11243case SyntaxKind.ExclusiveOrAssignmentExpression: 11244case SyntaxKind.OrAssignmentExpression: 11245case SyntaxKind.LeftShiftAssignmentExpression: 11246case SyntaxKind.RightShiftAssignmentExpression: 11247case SyntaxKind.UnsignedRightShiftAssignmentExpression: 11248case SyntaxKind.CoalesceAssignmentExpression: 11250case SyntaxKind.CoalesceExpression: 11251case SyntaxKind.ThrowExpression: 11253case SyntaxKind.LogicalOrExpression: 11255case SyntaxKind.LogicalAndExpression: 11257case SyntaxKind.BitwiseOrExpression: 11259case SyntaxKind.ExclusiveOrExpression: 11261case SyntaxKind.BitwiseAndExpression: 11263case SyntaxKind.EqualsExpression: 11264case SyntaxKind.NotEqualsExpression: 11266case SyntaxKind.LessThanExpression: 11267case SyntaxKind.LessThanOrEqualExpression: 11268case SyntaxKind.GreaterThanExpression: 11269case SyntaxKind.GreaterThanOrEqualExpression: 11270case SyntaxKind.IsExpression: 11271case SyntaxKind.AsExpression: 11272case SyntaxKind.IsPatternExpression: 11274case SyntaxKind.SwitchExpression: 11275case SyntaxKind.WithExpression: 11277case SyntaxKind.LeftShiftExpression: 11278case SyntaxKind.RightShiftExpression: 11279case SyntaxKind.UnsignedRightShiftExpression: 11281case SyntaxKind.AddExpression: 11282case SyntaxKind.SubtractExpression: 11284case SyntaxKind.MultiplyExpression: 11285case SyntaxKind.DivideExpression: 11286case SyntaxKind.ModuloExpression: 11288case SyntaxKind.UnaryPlusExpression: 11289case SyntaxKind.UnaryMinusExpression: 11290case SyntaxKind.BitwiseNotExpression: 11291case SyntaxKind.LogicalNotExpression: 11292case SyntaxKind.PreIncrementExpression: 11293case SyntaxKind.PreDecrementExpression: 11294case SyntaxKind.TypeOfExpression: 11295case SyntaxKind.SizeOfExpression: 11296case SyntaxKind.CheckedExpression: 11297case SyntaxKind.UncheckedExpression: 11298case SyntaxKind.MakeRefExpression: 11299case SyntaxKind.RefValueExpression: 11300case SyntaxKind.RefTypeExpression: 11301case SyntaxKind.AwaitExpression: 11302case SyntaxKind.IndexExpression: 11304case SyntaxKind.CastExpression: 11306case SyntaxKind.PointerIndirectionExpression: 11308case SyntaxKind.AddressOfExpression: 11310case SyntaxKind.RangeExpression: 11312case SyntaxKind.ConditionalExpression: 11314case SyntaxKind.AliasQualifiedName: 11315case SyntaxKind.AnonymousObjectCreationExpression: 11316case SyntaxKind.ArgListExpression: 11317case SyntaxKind.ArrayCreationExpression: 11318case SyntaxKind.BaseExpression: 11319case SyntaxKind.CharacterLiteralExpression: 11320case SyntaxKind.CollectionExpression: 11321case SyntaxKind.ConditionalAccessExpression: 11322case SyntaxKind.DeclarationExpression: 11323case SyntaxKind.DefaultExpression: 11324case SyntaxKind.DefaultLiteralExpression: 11325case SyntaxKind.ElementAccessExpression: 11326case SyntaxKind.FalseLiteralExpression: 11327case SyntaxKind.FieldExpression: 11328case SyntaxKind.GenericName: 11329case SyntaxKind.IdentifierName: 11330case SyntaxKind.ImplicitArrayCreationExpression: 11331case SyntaxKind.ImplicitStackAllocArrayCreationExpression: 11332case SyntaxKind.ImplicitObjectCreationExpression: 11333case SyntaxKind.InterpolatedStringExpression: 11334case SyntaxKind.InvocationExpression: 11335case SyntaxKind.NullLiteralExpression: 11336case SyntaxKind.NumericLiteralExpression: 11337case SyntaxKind.ObjectCreationExpression: 11338case SyntaxKind.ParenthesizedExpression: 11339case SyntaxKind.PointerMemberAccessExpression: 11340case SyntaxKind.PostDecrementExpression: 11341case SyntaxKind.PostIncrementExpression: 11342case SyntaxKind.PredefinedType: 11343case SyntaxKind.RefExpression: 11344case SyntaxKind.SimpleMemberAccessExpression: 11345case SyntaxKind.StackAllocArrayCreationExpression: 11346case SyntaxKind.StringLiteralExpression: 11347case SyntaxKind.Utf8StringLiteralExpression: 11348case SyntaxKind.SuppressNullableWarningExpression: 11349case SyntaxKind.ThisExpression: 11350case SyntaxKind.TrueLiteralExpression: 11351case SyntaxKind.TupleExpression: 11358private static bool IsExpectedPrefixUnaryOperator(SyntaxKind kind) 11360return SyntaxFacts.IsPrefixUnaryExpression(kind) && kind is not SyntaxKind.RefKeyword and not SyntaxKind.OutKeyword; 11363private static bool IsExpectedBinaryOperator(SyntaxKind kind) 11368private static bool IsExpectedAssignmentOperator(SyntaxKind kind) 11375return (this.IsScript || this.IsInAsync) && this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword; 11380if (this.CurrentToken.ContextualKind == SyntaxKind.AwaitKeyword) 11394case SyntaxKind.IdentifierToken: 11395return next.ContextualKind != SyntaxKind.WithKeyword; 11398case SyntaxKind.NewKeyword: 11399case SyntaxKind.ThisKeyword: 11400case SyntaxKind.BaseKeyword: 11401case SyntaxKind.DelegateKeyword: 11402case SyntaxKind.TypeOfKeyword: 11403case SyntaxKind.CheckedKeyword: 11404case SyntaxKind.UncheckedKeyword: 11405case SyntaxKind.DefaultKeyword: 11408case SyntaxKind.TrueKeyword: 11409case SyntaxKind.FalseKeyword: 11410case SyntaxKind.StringLiteralToken: 11411case SyntaxKind.SingleLineRawStringLiteralToken: 11412case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 11413case SyntaxKind.MultiLineRawStringLiteralToken: 11414case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 11415case SyntaxKind.InterpolatedStringToken: 11416case SyntaxKind.Utf8StringLiteralToken: 11417case SyntaxKind.InterpolatedStringStartToken: 11418case SyntaxKind.InterpolatedVerbatimStringStartToken: 11419case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 11420case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 11421case SyntaxKind.NumericLiteralToken: 11422case SyntaxKind.NullKeyword: 11423case SyntaxKind.CharacterLiteralToken: 11458var tk = this.CurrentToken.Kind; 11470var opKind = SyntaxFacts.GetPrefixUnaryExpression(tk); 11493this.EatContextualToken(SyntaxKind.AwaitKeyword), 11494this.ParseSubExpression(GetPrecedence(SyntaxKind.AwaitExpression))); 11500if (this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword && IsInQuery) 11510if (tk == SyntaxKind.ThrowKeyword) 11554if (this.CurrentToken.Kind == SyntaxKind.QuestionToken && precedence <= Precedence.Conditional) 11567if (operatorTokenKind == SyntaxKind.None) 11600leftOperand.Kind == SyntaxKind.IsPatternExpression ? ErrorCode.ERR_UnexpectedToken : ErrorCode.WRN_PrecedenceInversion, 11604if (operatorExpressionKind == SyntaxKind.AsExpression) 11610if (operatorExpressionKind == SyntaxKind.IsExpression) 11613if (operatorExpressionKind == SyntaxKind.SwitchExpression) 11616if (operatorExpressionKind == SyntaxKind.WithExpression) 11619if (operatorExpressionKind == SyntaxKind.RangeExpression) 11652if (this.CurrentToken.Kind != SyntaxKind.ColonToken && 11670if (this.CurrentToken.Kind == SyntaxKind.ColonToken) 11682if (this.CurrentToken.Kind == SyntaxKind.EndOfFileToken && this.lexer.InterpolationFollowedByColon) 11692SyntaxFactory.MissingToken(SyntaxKind.ColonToken), 11693_syntaxFactory.IdentifierName(SyntaxFactory.MissingToken(SyntaxKind.IdentifierToken))); 11702this.EatToken(SyntaxKind.ColonToken), 11716conditionalExpression.WhenTrue.GetFirstToken().Kind == SyntaxKind.OpenBracketToken) 11735private (SyntaxKind operatorTokenKind, SyntaxKind operatorExpressionKind) GetExpressionOperatorTokenKindAndExpressionKind() 11742var token1Kind = token1.ContextualKind; 11746return (SyntaxKind.DotDotToken, SyntaxKind.RangeExpression); 11751if (token1Kind == SyntaxKind.GreaterThanToken 11752&& this.PeekToken(1) is { Kind: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token2 11755if (token2.Kind == SyntaxKind.GreaterThanToken) 11757if (this.PeekToken(2) is { Kind: SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken } token3 11761token1Kind = token3.Kind == SyntaxKind.GreaterThanToken 11762? SyntaxKind.GreaterThanGreaterThanGreaterThanToken 11763: SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; 11768token1Kind = SyntaxKind.GreaterThanGreaterThanToken; 11774token1Kind = SyntaxKind.GreaterThanGreaterThanEqualsToken; 11784if (token1Kind == SyntaxKind.SwitchKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 11785return (token1Kind, SyntaxKind.SwitchExpression); 11787if (token1Kind == SyntaxKind.WithKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken) 11788return (token1Kind, SyntaxKind.WithExpression); 11792return (SyntaxKind.None, SyntaxKind.None); 11795private SyntaxToken EatExpressionOperatorToken(SyntaxKind operatorTokenKind) 11799if (operatorTokenKind is SyntaxKind.DotDotToken) 11802if (operatorTokenKind is SyntaxKind.GreaterThanGreaterThanToken or SyntaxKind.GreaterThanGreaterThanEqualsToken) 11815else if (operatorTokenKind is SyntaxKind.GreaterThanGreaterThanGreaterThanToken or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken) 11836private AssignmentExpressionSyntax ParseAssignmentExpression(SyntaxKind operatorExpressionKind, ExpressionSyntax leftOperand, SyntaxToken operatorToken) 11843if (operatorExpressionKind == SyntaxKind.SimpleAssignmentExpression && CurrentToken.Kind == SyntaxKind.RefKeyword && 11860/// <summary>Check if we're currently at a .. sequence that can then be parsed out as a <see cref="SyntaxKind.DotDotToken"/>.</summary> 11863if (this.CurrentToken.Kind != SyntaxKind.DotToken) 11867return nextToken.Kind == SyntaxKind.DotToken && NoTriviaBetween(this.CurrentToken, nextToken); 11871=> token1.Kind == SyntaxKind.DotToken && 11872token2.Kind == SyntaxKind.DotToken && 11875/// <summary>Consume the next two tokens as a <see cref="SyntaxKind.DotDotToken"/>. Note: if three dot tokens 11884var dotDotToken = SyntaxFactory.Token(token1.GetLeadingTrivia(), SyntaxKind.DotDotToken, token2.GetTrailingTrivia()); 11885if (this.CurrentToken is { Kind: SyntaxKind.DotToken } token3 && 11902if (this.PeekToken(1) is not { Kind: SyntaxKind.DotToken } token4 || 11917? EatContextualToken(SyntaxKind.ScopedKeyword) 11929this.EatToken(SyntaxKind.ThrowKeyword), 11939TypeSyntax type => _syntaxFactory.BinaryExpression(SyntaxKind.IsExpression, leftOperand, opToken, type), 11955var tk = this.CurrentToken.Kind; 11958case SyntaxKind.TypeOfKeyword: 11960case SyntaxKind.DefaultKeyword: 11962case SyntaxKind.SizeOfKeyword: 11964case SyntaxKind.MakeRefKeyword: 11966case SyntaxKind.RefTypeKeyword: 11968case SyntaxKind.CheckedKeyword: 11969case SyntaxKind.UncheckedKeyword: 11971case SyntaxKind.RefValueKeyword: 11973case SyntaxKind.ColonColonToken: 11978case SyntaxKind.EqualsGreaterThanToken: 11980case SyntaxKind.StaticKeyword: 11993case SyntaxKind.IdentifierToken: 12009else if (IsCurrentTokenFieldInKeywordContext() && PeekToken(1).Kind != SyntaxKind.ColonColonToken) 12011return _syntaxFactory.FieldExpression(this.EatContextualToken(SyntaxKind.FieldKeyword)); 12023case SyntaxKind.OpenBracketToken: 12027case SyntaxKind.ThisKeyword: 12029case SyntaxKind.BaseKeyword: 12032case SyntaxKind.ArgListKeyword: 12033case SyntaxKind.FalseKeyword: 12034case SyntaxKind.TrueKeyword: 12035case SyntaxKind.NullKeyword: 12036case SyntaxKind.NumericLiteralToken: 12037case SyntaxKind.StringLiteralToken: 12038case SyntaxKind.Utf8StringLiteralToken: 12039case SyntaxKind.CharacterLiteralToken: 12041case SyntaxKind.InterpolatedStringStartToken: 12042case SyntaxKind.InterpolatedVerbatimStringStartToken: 12043case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 12044case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 12046case SyntaxKind.InterpolatedStringToken: 12048case SyntaxKind.SingleLineRawStringLiteralToken: 12049case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 12050case SyntaxKind.MultiLineRawStringLiteralToken: 12051case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 12053case SyntaxKind.OpenParenToken: 12059case SyntaxKind.NewKeyword: 12061case SyntaxKind.StackAllocKeyword: 12063case SyntaxKind.DelegateKeyword: 12068case SyntaxKind.RefKeyword: 12088if (this.CurrentToken.Kind != SyntaxKind.DotToken || tk == SyntaxKind.VoidKeyword) 12099if (tk == SyntaxKind.EndOfFileToken) 12140case SyntaxKind.OpenParenToken: 12144case SyntaxKind.OpenBracketToken: 12148case SyntaxKind.PlusPlusToken: 12149case SyntaxKind.MinusMinusToken: 12153case SyntaxKind.ColonColonToken: 12154if (this.PeekToken(1).Kind == SyntaxKind.IdentifierToken) 12157SyntaxKind.SimpleMemberAccessExpression, 12160this.ConvertToMissingWithTrailingTrivia(this.AddError(this.EatToken(), ErrorCode.ERR_UnexpectedAliasedName), SyntaxKind.DotToken), 12166expr = AddTrailingSkippedSyntax(expr, this.EatTokenEvenWithIncorrectKind(SyntaxKind.DotToken)); 12171case SyntaxKind.MinusGreaterThanToken: 12172expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.PointerMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 12175case SyntaxKind.DotToken when !IsAtDotDotToken(): 12185if (this.CurrentToken.TrailingTrivia.Any((int)SyntaxKind.EndOfLineTrivia) && 12186this.PeekToken(1).Kind == SyntaxKind.IdentifierToken && 12187this.PeekToken(2).ContextualKind == SyntaxKind.IdentifierToken) 12190SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), 12194expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)); 12197case SyntaxKind.QuestionToken: 12206case SyntaxKind.ExclamationToken: 12207expr = _syntaxFactory.PostfixUnaryExpression(SyntaxKind.SuppressNullableWarningExpression, expr, this.EatToken()); 12219Debug.Assert(this.CurrentToken.Kind == SyntaxKind.BaseKeyword); 12242this.CurrentToken.Kind == SyntaxKind.OpenParenToken && ScanDesignator() && 12243this.CurrentToken.Kind == SyntaxKind.EqualsToken; 12250case SyntaxKind.IdentifierToken: 12258case SyntaxKind.OpenParenToken: 12269case SyntaxKind.CommaToken: 12271case SyntaxKind.CloseParenToken: 12287while (this.PeekToken(tokenIndex).Kind == SyntaxKind.StaticKeyword || 12288this.PeekToken(tokenIndex).ContextualKind == SyntaxKind.AsyncKeyword) 12293return this.PeekToken(tokenIndex).Kind == SyntaxKind.DelegateKeyword && 12294this.PeekToken(tokenIndex + 1).Kind != SyntaxKind.AsteriskToken; 12341if (this.CurrentToken.Kind == SyntaxKind.QuestionToken) 12344var nextTokenKind = nextToken.Kind; 12349if (nextTokenKind == SyntaxKind.DotToken && !IsAtDotDotToken(nextToken, this.PeekToken(2))) 12361bool isStartOfElementBindingExpression(SyntaxKind nextTokenKind) 12363if (nextTokenKind != SyntaxKind.OpenBracketToken) 12380return this.CurrentToken.Kind != SyntaxKind.ColonToken; 12393while (this.CurrentToken.Kind == SyntaxKind.ExclamationToken) 12394expr = _syntaxFactory.PostfixUnaryExpression(SyntaxKind.SuppressNullableWarningExpression, expr, EatToken()); 12431SyntaxKind.OpenParenToken 12433SyntaxKind.OpenBracketToken 12435SyntaxKind.DotToken 12436=> _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, expr, this.EatToken(), this.ParseSimpleName(NameOptions.InExpression)), 12445if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.ArgumentList) 12454openKind: SyntaxKind.OpenParenToken, 12455closeKind: SyntaxKind.CloseParenToken); 12461if (this.IsIncrementalAndFactoryContextMatches && this.CurrentNodeKind == SyntaxKind.BracketedArgumentList) 12470openKind: SyntaxKind.OpenBracketToken, 12471closeKind: SyntaxKind.CloseBracketToken); 12479SyntaxKind openKind, 12480SyntaxKind closeKind) 12482Debug.Assert(openKind is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken); 12483Debug.Assert(closeKind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken); 12484Debug.Assert((openKind == SyntaxKind.OpenParenToken) == (closeKind == SyntaxKind.CloseParenToken)); 12485bool isIndexer = openKind == SyntaxKind.OpenBracketToken; 12488openToken = this.CurrentToken.Kind is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken 12495if (this.CurrentToken.Kind != closeKind && this.CurrentToken.Kind != SyntaxKind.SemicolonToken) 12502SyntaxKind.CloseBracketToken, 12514SyntaxKind.CloseParenToken, 12539closeToken = this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken 12546LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<ArgumentSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 12548if (@this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken or SyntaxKind.SemicolonToken) 12552static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleArgumentExpression(), 12553static (p, closeKind) => p.CurrentToken.Kind == closeKind || p.CurrentToken.Kind == SyntaxKind.SemicolonToken, 12560return this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken; 12568private static bool IsValidArgumentRefKindKeyword(SyntaxKind kind) 12572case SyntaxKind.RefKeyword: 12573case SyntaxKind.OutKeyword: 12574case SyntaxKind.InKeyword: 12583var nameColon = this.CurrentToken.Kind == SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.ColonToken 12586this.EatToken(SyntaxKind.ColonToken)) 12592!(this.CurrentToken.Kind == SyntaxKind.RefKeyword && 12600if (isIndexer && this.CurrentToken.Kind is SyntaxKind.CommaToken or SyntaxKind.CloseBracketToken) 12604else if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 12616expression = refKindKeyword?.Kind == SyntaxKind.OutKeyword 12628this.EatToken(SyntaxKind.OpenParenToken), 12630this.EatToken(SyntaxKind.CloseParenToken)); 12636if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 12640this.EatToken(SyntaxKind.OpenParenToken), 12642this.EatToken(SyntaxKind.CloseParenToken)); 12646return _syntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression, keyword); 12654this.EatToken(SyntaxKind.OpenParenToken), 12656this.EatToken(SyntaxKind.CloseParenToken)); 12663this.EatToken(SyntaxKind.OpenParenToken), 12665this.EatToken(SyntaxKind.CloseParenToken)); 12672this.EatToken(SyntaxKind.OpenParenToken), 12674this.EatToken(SyntaxKind.CloseParenToken)); 12680Debug.Assert(checkedOrUnchecked.Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword); 12681var kind = checkedOrUnchecked.Kind == SyntaxKind.CheckedKeyword ? SyntaxKind.CheckedExpression : SyntaxKind.UncheckedExpression; 12686this.EatToken(SyntaxKind.OpenParenToken), 12688this.EatToken(SyntaxKind.CloseParenToken)); 12694this.EatToken(SyntaxKind.RefValueKeyword), 12695this.EatToken(SyntaxKind.OpenParenToken), 12697this.EatToken(SyntaxKind.CommaToken), 12699this.EatToken(SyntaxKind.CloseParenToken)); 12714Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 12732token.Kind is SyntaxKind.CommaToken || 12738return token.Kind == SyntaxKind.CloseParenToken && 12739this.PeekToken(index).Kind == SyntaxKind.EqualsGreaterThanToken; 12745Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 12787var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 12797if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken) 12807case SyntaxKind.CommaToken: 12810case SyntaxKind.CloseParenToken: 12811return this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken; 12821Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenParenToken); 12836this.EatToken(SyntaxKind.OpenParenToken), 12838this.EatToken(SyntaxKind.CloseParenToken), 12845var openParen = this.EatToken(SyntaxKind.OpenParenToken); 12849if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 12857if (expression.Kind == SyntaxKind.IdentifierName && this.CurrentToken.Kind == SyntaxKind.ColonToken) 12870this.EatToken(SyntaxKind.CloseParenToken)); 12878while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 12880list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 12883var argument = expression.Kind != SyntaxKind.IdentifierName || this.CurrentToken.Kind != SyntaxKind.ColonToken 12895list.AddSeparator(SyntaxFactory.MissingToken(SyntaxKind.CommaToken)); 12904this.EatToken(SyntaxKind.CloseParenToken)); 12911if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 12924if (this.CurrentToken.Kind != SyntaxKind.CloseParenToken) 12931if (forPattern && this.CurrentToken.Kind == SyntaxKind.IdentifierToken) 12943if (inSwitchArmPattern && this.CurrentToken.ContextualKind == SyntaxKind.WhenKeyword) 12967SyntaxKind.PlusToken or 12968SyntaxKind.MinusToken or 12969SyntaxKind.AmpersandToken or 12970SyntaxKind.AsteriskToken 12974SyntaxKind.DotToken when IsAtDotDotToken() 12990return this.CurrentToken.Kind == SyntaxKind.OpenBracketToken || CanFollowCast(this.CurrentToken.Kind); 12996if (this.CurrentToken.Kind == SyntaxKind.OpenBracketToken && 12997this.PeekToken(1).Kind == SyntaxKind.CloseBracketToken) 13036return this.CurrentToken.ContextualKind is SyntaxKind.OrKeyword or SyntaxKind.AndKeyword; 13057if (token1.Kind == SyntaxKind.EqualsGreaterThanToken) 13065if (CurrentToken.Kind == SyntaxKind.OpenBracketToken) 13081if (this.CurrentToken.Kind == SyntaxKind.StaticKeyword) 13086else if (this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword && 13087this.PeekToken(1).Kind == SyntaxKind.StaticKeyword) 13100if (this.CurrentToken.Kind == SyntaxKind.EqualsGreaterThanToken) 13110if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13118if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && 13119this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13129if (this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword && 13138if (st == ScanTypeFlags.NotType || this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 13155if (this.CurrentToken.Kind == SyntaxKind.IdentifierToken && 13156this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13163if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 13172private static bool CanFollowCast(SyntaxKind kind) 13176case SyntaxKind.AsKeyword: 13177case SyntaxKind.IsKeyword: 13178case SyntaxKind.SemicolonToken: 13179case SyntaxKind.CloseParenToken: 13180case SyntaxKind.CloseBracketToken: 13181case SyntaxKind.OpenBraceToken: 13182case SyntaxKind.CloseBraceToken: 13183case SyntaxKind.CommaToken: 13184case SyntaxKind.EqualsToken: 13185case SyntaxKind.PlusEqualsToken: 13186case SyntaxKind.MinusEqualsToken: 13187case SyntaxKind.AsteriskEqualsToken: 13188case SyntaxKind.SlashEqualsToken: 13189case SyntaxKind.PercentEqualsToken: 13190case SyntaxKind.AmpersandEqualsToken: 13191case SyntaxKind.CaretEqualsToken: 13192case SyntaxKind.BarEqualsToken: 13193case SyntaxKind.LessThanLessThanEqualsToken: 13194case SyntaxKind.GreaterThanGreaterThanEqualsToken: 13195case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 13196case SyntaxKind.QuestionToken: 13197case SyntaxKind.ColonToken: 13198case SyntaxKind.BarBarToken: 13199case SyntaxKind.AmpersandAmpersandToken: 13200case SyntaxKind.BarToken: 13201case SyntaxKind.CaretToken: 13202case SyntaxKind.AmpersandToken: 13203case SyntaxKind.EqualsEqualsToken: 13204case SyntaxKind.ExclamationEqualsToken: 13205case SyntaxKind.LessThanToken: 13206case SyntaxKind.LessThanEqualsToken: 13207case SyntaxKind.GreaterThanToken: 13208case SyntaxKind.GreaterThanEqualsToken: 13209case SyntaxKind.QuestionQuestionEqualsToken: 13210case SyntaxKind.LessThanLessThanToken: 13211case SyntaxKind.GreaterThanGreaterThanToken: 13212case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 13213case SyntaxKind.PlusToken: 13214case SyntaxKind.MinusToken: 13215case SyntaxKind.AsteriskToken: 13216case SyntaxKind.SlashToken: 13217case SyntaxKind.PercentToken: 13218case SyntaxKind.PlusPlusToken: 13219case SyntaxKind.MinusMinusToken: 13220case SyntaxKind.OpenBracketToken: 13221case SyntaxKind.DotToken: 13222case SyntaxKind.MinusGreaterThanToken: 13223case SyntaxKind.QuestionQuestionToken: 13224case SyntaxKind.EndOfFileToken: 13225case SyntaxKind.SwitchKeyword: 13226case SyntaxKind.EqualsGreaterThanToken: 13235Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NewKeyword); 13254Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenBracketToken); 13255var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 13258SyntaxKind.CloseBracketToken, 13269this.EatToken(SyntaxKind.CloseBracketToken)); 13272LanguageParser @this, ref SyntaxToken openBracket, SeparatedSyntaxListBuilder<CollectionElementSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13275static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleCollectionElement(), 13290if (this.CurrentToken.ContextualKind == SyntaxKind.WithKeyword && 13291this.PeekToken(1).Kind == SyntaxKind.OpenParenToken) 13293return _syntaxFactory.WithElement(this.EatContextualToken(SyntaxKind.WithKeyword), this.ParseParenthesizedArgumentList()); 13308return this.CurrentToken.Kind == SyntaxKind.NewKeyword && this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken; 13314var @new = this.EatToken(SyntaxKind.NewKeyword); 13316Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenBraceToken); 13318var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13321SyntaxKind.CloseBraceToken, 13333this.EatToken(SyntaxKind.CloseBraceToken)); 13353return this.CurrentToken.Kind == SyntaxKind.OpenBraceToken; 13358return IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.EqualsToken; 13363return IsTrueIdentifier() && this.PeekToken(1).Kind is SyntaxKind.EqualsToken or SyntaxKind.ColonToken; 13368return this.CurrentToken.Kind == SyntaxKind.OpenBracketToken; 13373SyntaxToken @new = this.EatToken(SyntaxKind.NewKeyword); 13381if (type.Kind == SyntaxKind.ArrayType) 13384if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken) 13394if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13399if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken) 13408this.EatToken(SyntaxKind.OpenParenToken, ErrorCode.ERR_BadNewExpr, reportError: type?.ContainsDiagnostics == false), 13410SyntaxFactory.MissingToken(SyntaxKind.CloseParenToken)); 13421if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 13434case SyntaxKind.QuestionToken: // e.g. `new(a, b)?()` 13435case SyntaxKind.OpenBracketToken: // e.g. `new(a, b)[]` 13436case SyntaxKind.OpenParenToken: // e.g. `new(a, b)()` for better error recovery 13448var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13451SyntaxKind.CloseBraceToken, 13463SyntaxKind.WithInitializerExpression, 13466this.EatToken(SyntaxKind.CloseBraceToken))); 13473var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13477SyntaxKind.CloseBraceToken, 13485var kind = isObjectInitializer(initializers) ? SyntaxKind.ObjectInitializerExpression : SyntaxKind.CollectionInitializerExpression; 13491this.EatToken(SyntaxKind.CloseBraceToken)); 13505Kind: SyntaxKind.SimpleAssignmentExpression, 13506Left.Kind: SyntaxKind.IdentifierName or SyntaxKind.ImplicitElementAccess, 13547LanguageParser @this, ref SyntaxToken startToken, SeparatedSyntaxListBuilder<T> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13551static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleExpression(), 13559SyntaxKind.SimpleAssignmentExpression, 13561this.CurrentToken.Kind == SyntaxKind.ColonToken 13562? this.EatTokenAsKind(SyntaxKind.EqualsToken) 13563: this.EatToken(SyntaxKind.EqualsToken), 13564this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 13572SyntaxKind.SimpleAssignmentExpression, 13574this.EatToken(SyntaxKind.EqualsToken), 13575this.CurrentToken.Kind == SyntaxKind.OpenBraceToken 13582var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13586SyntaxKind.CloseBraceToken, 13595SyntaxKind.ComplexElementInitializerExpression, 13598this.EatToken(SyntaxKind.CloseBraceToken)); 13603Debug.Assert(this.CurrentToken.Kind is SyntaxKind.NewKeyword or SyntaxKind.StackAllocKeyword); 13604return this.PeekToken(1).Kind == SyntaxKind.OpenBracketToken; 13609var @new = this.EatToken(SyntaxKind.NewKeyword); 13610var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 13630if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 13643this.EatToken(SyntaxKind.CloseBracketToken), 13649var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13652SyntaxKind.CloseBraceToken, 13661SyntaxKind.ArrayInitializerExpression, 13664this.EatToken(SyntaxKind.CloseBraceToken)); 13667LanguageParser @this, ref SyntaxToken openBrace, SeparatedSyntaxListBuilder<ExpressionSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13670static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleVariableInitializer(), 13685var @stackalloc = this.EatToken(SyntaxKind.StackAllocKeyword); 13686var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 13697if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 13710this.EatToken(SyntaxKind.CloseBracketToken), 13717this.EatToken(SyntaxKind.StackAllocKeyword), 13719this.CurrentToken.Kind == SyntaxKind.OpenBraceToken ? this.ParseArrayInitializer() : null); 13726isInAsyncContext: this.IsInAsync || modifiers.Any((int)SyntaxKind.AsyncKeyword), 13733var @delegate = this.EatToken(SyntaxKind.DelegateKeyword); 13736if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13749if (this.CurrentToken.Kind != SyntaxKind.OpenBraceToken) 13752var openBrace = this.EatToken(SyntaxKind.OpenBraceToken); 13761SyntaxFactory.MissingToken(SyntaxKind.CloseBraceToken)), 13780if (this.CurrentToken.Kind == SyntaxKind.StaticKeyword) 13782modifiers.Add(this.EatToken(SyntaxKind.StaticKeyword)); 13786if (this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword && 13789modifiers.Add(this.EatContextualToken(SyntaxKind.AsyncKeyword)); 13801Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword); 13805case SyntaxKind.OpenParenToken: 13806case SyntaxKind.IdentifierToken: 13807case SyntaxKind.StaticKeyword: 13808case SyntaxKind.RefKeyword: 13809case SyntaxKind.DelegateKeyword: 13826if (this.CurrentToken.Kind == SyntaxKind.ColonToken && 13843isInAsyncContext: this.IsInAsync || modifiers.Any((int)SyntaxKind.AsyncKeyword), 13854if (CurrentToken.Kind != SyntaxKind.OpenParenToken) 13861if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 13864var arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken); 13874var identifier = (this.CurrentToken.Kind != SyntaxKind.IdentifierToken && this.PeekToken(1).Kind == SyntaxKind.EqualsGreaterThanToken) 13875? this.EatTokenAsKind(SyntaxKind.IdentifierToken) 13879var arrow = this.EatToken(SyntaxKind.EqualsGreaterThanToken); 13891=> CurrentToken.Kind == SyntaxKind.OpenBraceToken 13897var openParen = this.EatToken(SyntaxKind.OpenParenToken); 13903SyntaxKind.CloseParenToken, 13916this.EatToken(SyntaxKind.CloseParenToken)); 13919LanguageParser @this, ref SyntaxToken openParen, SeparatedSyntaxListBuilder<ParameterSyntax> list, SyntaxKind expectedKind, SyntaxKind closeKind) 13922static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleLambdaParameter(), 13932case SyntaxKind.ParamsKeyword: 13933case SyntaxKind.ReadOnlyKeyword: 13934case SyntaxKind.RefKeyword: 13935case SyntaxKind.OutKeyword: 13936case SyntaxKind.InKeyword: 13937case SyntaxKind.OpenParenToken: // tuple 13938case SyntaxKind.OpenBracketToken: // attribute 13941case SyntaxKind.IdentifierToken: 13944case SyntaxKind.DelegateKeyword: 13971var equalsToken = TryEatToken(SyntaxKind.EqualsToken); 13992if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken) 14015is not SyntaxKind.CommaToken 14016and not SyntaxKind.CloseParenToken 14017and not SyntaxKind.EqualsGreaterThanToken 14018and not SyntaxKind.OpenBraceToken 14019and not SyntaxKind.EqualsToken) 14040case SyntaxKind.OnKeyword: 14041case SyntaxKind.EqualsKeyword: 14042case SyntaxKind.AscendingKeyword: 14043case SyntaxKind.DescendingKeyword: 14044case SyntaxKind.ByKeyword: 14055case SyntaxKind.FromKeyword: 14056case SyntaxKind.JoinKeyword: 14057case SyntaxKind.IntoKeyword: 14058case SyntaxKind.WhereKeyword: 14059case SyntaxKind.OrderByKeyword: 14060case SyntaxKind.GroupKeyword: 14061case SyntaxKind.SelectKeyword: 14062case SyntaxKind.LetKeyword: 14071return this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword && 14079var pk1 = this.PeekToken(1).Kind; 14085if (pk1 == SyntaxKind.IdentifierToken) 14087var pk2 = this.PeekToken(2).Kind; 14088if (pk2 == SyntaxKind.InKeyword) 14095if (pk2 is SyntaxKind.SemicolonToken or // from x; 14096SyntaxKind.CommaToken or // from x, y; 14097SyntaxKind.EqualsToken) // from x = null; 14107if (pk2 is SyntaxKind.OpenParenToken or SyntaxKind.OpenBraceToken) 14124return this.ScanType() != ScanTypeFlags.NotType && this.CurrentToken.Kind is SyntaxKind.IdentifierToken or SyntaxKind.InKeyword; 14135: this.AddError(fromClause, ErrorCode.WRN_PrecedenceInversion, SyntaxFacts.GetText(SyntaxKind.FromKeyword)), 14148case SyntaxKind.FromKeyword: 14151case SyntaxKind.JoinKeyword: 14154case SyntaxKind.LetKeyword: 14157case SyntaxKind.WhereKeyword: 14160case SyntaxKind.OrderByKeyword: 14171SyntaxKind.SelectKeyword => this.ParseSelectClause(), 14172SyntaxKind.GroupKeyword => this.ParseGroupClause(), 14174this.EatToken(SyntaxKind.SelectKeyword, ErrorCode.ERR_ExpectedSelectOrGroup), 14181this.CurrentToken.ContextualKind == SyntaxKind.IntoKeyword 14188Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword); 14189var @from = this.EatContextualToken(SyntaxKind.FromKeyword); 14191var type = this.PeekToken(1).Kind != SyntaxKind.InKeyword 14196if (this.PeekToken(1).ContextualKind == SyntaxKind.InKeyword && 14197(this.CurrentToken.Kind != SyntaxKind.IdentifierToken || SyntaxFacts.IsQueryContextualKeyword(this.CurrentToken.ContextualKind))) 14203name = WithAdditionalDiagnostics(name, this.GetExpectedTokenError(SyntaxKind.IdentifierToken, name.ContextualKind, name.GetLeadingTriviaWidth(), name.Width)); 14204name = this.ConvertToMissingWithTrailingTrivia(name, SyntaxKind.IdentifierToken); 14215this.EatToken(SyntaxKind.InKeyword), 14221Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.JoinKeyword); 14223joinKeyword: this.EatContextualToken(SyntaxKind.JoinKeyword), 14224type: this.PeekToken(1).Kind != SyntaxKind.InKeyword 14228inKeyword: this.EatToken(SyntaxKind.InKeyword), 14230onKeyword: this.EatContextualToken(SyntaxKind.OnKeyword, ErrorCode.ERR_ExpectedContextualKeywordOn), 14232equalsKeyword: this.EatContextualToken(SyntaxKind.EqualsKeyword, ErrorCode.ERR_ExpectedContextualKeywordEquals), 14234into: this.CurrentToken.ContextualKind == SyntaxKind.IntoKeyword 14241Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.LetKeyword); 14243this.EatContextualToken(SyntaxKind.LetKeyword), 14245SyntaxFacts.IsReservedKeyword(this.CurrentToken.Kind) && this.PeekToken(1).Kind == SyntaxKind.EqualsToken 14246? this.EatTokenAsKind(SyntaxKind.IdentifierToken) 14248this.EatToken(SyntaxKind.EqualsToken), 14254Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword); 14256this.EatContextualToken(SyntaxKind.WhereKeyword), 14262Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.OrderByKeyword); 14263var @orderby = this.EatContextualToken(SyntaxKind.OrderByKeyword); 14270while (this.CurrentToken.Kind == SyntaxKind.CommaToken) 14272if (this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.SemicolonToken) 14276else if (this.CurrentToken.Kind == SyntaxKind.CommaToken) 14278list.AddSeparator(this.EatToken(SyntaxKind.CommaToken)); 14282else if (skipBadOrderingListTokens(list, SyntaxKind.CommaToken) == PostSkipAction.Abort) 14292PostSkipAction skipBadOrderingListTokens(SeparatedSyntaxListBuilder<OrderingSyntax> list, SyntaxKind expected) 14297static p => p.CurrentToken.Kind != SyntaxKind.CommaToken, 14298static (p, _) => p.CurrentToken.Kind == SyntaxKind.CloseParenToken 14299|| p.CurrentToken.Kind == SyntaxKind.SemicolonToken 14309SyntaxKind kind = SyntaxKind.AscendingOrdering; 14311if (this.CurrentToken.ContextualKind is SyntaxKind.AscendingKeyword or SyntaxKind.DescendingKeyword) 14314if (direction.Kind == SyntaxKind.DescendingKeyword) 14316kind = SyntaxKind.DescendingOrdering; 14325Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.SelectKeyword); 14327this.EatContextualToken(SyntaxKind.SelectKeyword), 14333Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.GroupKeyword); 14335this.EatContextualToken(SyntaxKind.GroupKeyword), 14337this.EatContextualToken(SyntaxKind.ByKeyword, ErrorCode.ERR_ExpectedContextualKeywordBy), 14343Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.IntoKeyword); 14345this.EatContextualToken(SyntaxKind.IntoKeyword), 14404LanguageParser parser, ref SyntaxToken openToken, SeparatedSyntaxListBuilder<TNode> builder, SyntaxKind expectedKind, SyntaxKind closeTokenKind) where TNode : GreenNode; 14437SyntaxKind closeTokenKind, 14459SyntaxKind closeTokenKind, 14470var separatorTokenKind = SyntaxKind.CommaToken; 14502nodes.AddSeparator(this.CurrentToken.Kind == SyntaxKind.SemicolonToken 14529else if (skipBadTokens(this, ref openToken, nodes, SyntaxKind.IdentifierToken, closeTokenKind) == PostSkipAction.Continue) 14549if (allowSemicolonAsSeparator && this.CurrentToken.Kind is SyntaxKind.SemicolonToken) 14638if (this.CurrentToken.Kind == SyntaxKind.EndOfFileToken) return node; 14640while (this.CurrentToken.Kind != SyntaxKind.EndOfFileToken)
Parser\LanguageParser_InterpolatedString.cs (24)
20var expressionKind = SyntaxFacts.GetLiteralExpression(originalToken.Kind); 21Debug.Assert(expressionKind != SyntaxKind.None); 34Debug.Assert(interpolatedString.StringStartToken.Kind is SyntaxKind.InterpolatedSingleLineRawStringStartToken or SyntaxKind.InterpolatedMultiLineRawStringStartToken); 112Debug.Assert(this.CurrentToken.Kind == SyntaxKind.InterpolatedStringToken); 181Lexer.InterpolatedStringKind.Normal => SyntaxKind.InterpolatedStringStartToken, 182Lexer.InterpolatedStringKind.Verbatim => SyntaxKind.InterpolatedVerbatimStringStartToken, 183Lexer.InterpolatedStringKind.SingleLineRaw => SyntaxKind.InterpolatedSingleLineRawStringStartToken, 184Lexer.InterpolatedStringKind.MultiLineRaw => SyntaxKind.InterpolatedMultiLineRawStringStartToken, 259SyntaxFactory.Literal(leading: null, "", SyntaxKind.InterpolatedStringTextToken, "", trailing: null)); 339SyntaxFactory.Literal(leading: null, textString, SyntaxKind.InterpolatedStringTextToken, valueString, trailing: null)); 353Lexer.InterpolatedStringKind.Normal => SyntaxKind.InterpolatedStringEndToken, 354Lexer.InterpolatedStringKind.Verbatim => SyntaxKind.InterpolatedStringEndToken, 355Lexer.InterpolatedStringKind.SingleLineRaw => SyntaxKind.InterpolatedRawStringEndToken, 356Lexer.InterpolatedStringKind.MultiLineRaw => SyntaxKind.InterpolatedRawStringEndToken, 445private static SyntaxToken TokenOrMissingToken(GreenNode? leading, SyntaxKind kind, string text, GreenNode? trailing) 512SyntaxFactory.Token(leading: null, SyntaxKind.OpenBraceToken, text[interpolation.OpenBraceRange], openTokenTrailingTrivia)); 537if (this.CurrentToken.Kind != SyntaxKind.CommaToken) 543this.EatToken(SyntaxKind.CommaToken), 554SyntaxFactory.Token(leading, SyntaxKind.ColonToken, text[interpolation.ColonRange], trailing: null), 568SyntaxKind.CloseBraceToken, 584return SyntaxFactory.Literal(leading: null, text, SyntaxKind.InterpolatedStringTextToken, text, trailing: null); 595Debug.Assert(token.Kind == SyntaxKind.StringLiteralToken); 596var result = SyntaxFactory.Literal(leading: null, text, SyntaxKind.InterpolatedStringTextToken, token.ValueText, trailing: null);
Parser\LanguageParser_Patterns.cs (115)
23var pattern = ParsePattern(GetPrecedence(SyntaxKind.IsPatternExpression), afterIs: true); 40case MemberAccessExpressionSyntax { Expression: var expr, OperatorToken: { Kind: SyntaxKind.DotToken } dotToken, Name: var simpleName } 61while (this.CurrentToken.ContextualKind == SyntaxKind.OrKeyword) 64SyntaxKind.OrPattern, 78var tk = CurrentToken.Kind; 84if (tk == SyntaxKind.IdentifierToken && this.CurrentToken.ContextualKind != SyntaxKind.UnderscoreToken && 85(this.CurrentToken.ContextualKind != SyntaxKind.NameOfKeyword || this.PeekToken(1).Kind != SyntaxKind.OpenParenToken)) 107while (this.CurrentToken.ContextualKind == SyntaxKind.AndKeyword) 110SyntaxKind.AndPattern, 125case SyntaxKind.IdentifierToken: 129case SyntaxKind.OpenParenToken: 145case SyntaxKind.CloseParenToken: 148case SyntaxKind.CommaToken: 160if (this.CurrentToken.ContextualKind == SyntaxKind.NotKeyword) 166else if (this.CurrentToken.Kind == SyntaxKind.EqualsEqualsToken) 172else if (this.CurrentToken.Kind == SyntaxKind.ExclamationEqualsToken) 177SyntaxFactory.MissingToken(SyntaxKind.NotKeyword), 190var tk = this.CurrentToken.Kind; 193case SyntaxKind.CommaToken: 194case SyntaxKind.SemicolonToken: 195case SyntaxKind.CloseBraceToken: 196case SyntaxKind.CloseParenToken: 197case SyntaxKind.CloseBracketToken: 198case SyntaxKind.EqualsGreaterThanToken: 202if (CurrentToken.ContextualKind == SyntaxKind.UnderscoreToken) 204return _syntaxFactory.DiscardPattern(this.EatContextualToken(SyntaxKind.UnderscoreToken)); 209case SyntaxKind.OpenBracketToken: 211case SyntaxKind.DotToken when IsAtDotDotToken(): 217case SyntaxKind.LessThanToken: 218case SyntaxKind.LessThanEqualsToken: 219case SyntaxKind.GreaterThanToken: 220case SyntaxKind.GreaterThanEqualsToken: 221case SyntaxKind.EqualsEqualsToken: 222case SyntaxKind.ExclamationEqualsToken: 261case SyntaxKind.OpenParenToken: 262case SyntaxKind.OpenBraceToken: 263case SyntaxKind.IdentifierToken: 264case SyntaxKind.CloseBraceToken: // for efficiency, test some tokens that can follow a type pattern 265case SyntaxKind.CloseBracketToken: 266case SyntaxKind.CloseParenToken: 267case SyntaxKind.CommaToken: 268case SyntaxKind.SemicolonToken: 270case SyntaxKind.DotToken: 273case SyntaxKind.MinusGreaterThanToken: 274case SyntaxKind.ExclamationToken: 286if (type?.Kind == SyntaxKind.IdentifierName) 290if (typeIdentifierToken.ContextualKind == SyntaxKind.VarKeyword && 291(this.CurrentToken.Kind == SyntaxKind.OpenParenToken || this.IsValidPatternDesignation(inSwitchArmPattern))) 300if (this.CurrentToken.Kind == SyntaxKind.OpenParenToken && (type != null || !looksLikeCast())) 304var openParenToken = this.EatToken(SyntaxKind.OpenParenToken); 307SyntaxKind.CloseParenToken, 314var closeParenToken = this.EatToken(SyntaxKind.CloseParenToken); 379this.PeekToken(1).Kind == SyntaxKind.OpenBraceToken 383if (this.CurrentToken.Kind == SyntaxKind.OpenBraceToken) 409if (CurrentToken.Kind == SyntaxKind.IdentifierToken) 413case SyntaxKind.WhenKeyword: 417case SyntaxKind.AndKeyword: 418case SyntaxKind.OrKeyword: 419var tk = PeekToken(1).Kind; 422case SyntaxKind.CloseBraceToken: 423case SyntaxKind.CloseBracketToken: 424case SyntaxKind.CloseParenToken: 425case SyntaxKind.CommaToken: 426case SyntaxKind.SemicolonToken: 427case SyntaxKind.QuestionToken: 428case SyntaxKind.ColonToken: 430case SyntaxKind.LessThanEqualsToken: 431case SyntaxKind.LessThanToken: 432case SyntaxKind.GreaterThanEqualsToken: 433case SyntaxKind.GreaterThanToken: 434case SyntaxKind.IdentifierToken: 435case SyntaxKind.OpenBraceToken: 436case SyntaxKind.OpenParenToken: 437case SyntaxKind.OpenBracketToken: 450case SyntaxKind.UnderscoreToken: // discard is a valid pattern designation 492expr = _syntaxFactory.MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, newLeft, dotToken, right); 502if (this.CurrentToken.Kind != SyntaxKind.OpenParenToken) 511var openBraceToken = this.EatToken(SyntaxKind.OpenBraceToken); 514SyntaxKind.CloseBraceToken, 525this.EatToken(SyntaxKind.CloseBraceToken)); 534if (this.CurrentToken.Kind == SyntaxKind.ColonToken && ConvertPatternToExpressionIfPossible(pattern, permitTypeArguments: true) is ExpressionSyntax expr) 556SyntaxKind.OpenBraceToken or 557SyntaxKind.OpenBracketToken or 558SyntaxKind.LessThanToken or 559SyntaxKind.LessThanEqualsToken or 560SyntaxKind.GreaterThanToken or 561SyntaxKind.GreaterThanEqualsToken; 565LanguageParser @this, ref SyntaxToken open, SeparatedSyntaxListBuilder<T> list, SyntaxKind expectedKind, SyntaxKind closeKind) 568if (@this.CurrentToken.Kind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBraceToken or SyntaxKind.CloseBracketToken or SyntaxKind.SemicolonToken) 575if (@this._termState.HasFlag(TerminatorState.IsExpressionOrPatternInCaseLabelOfSwitchStatement) && @this.CurrentToken.Kind is SyntaxKind.ColonToken) 584if (@this._termState.HasFlag(TerminatorState.IsPatternInSwitchExpressionArm) && @this.CurrentToken.Kind is SyntaxKind.EqualsGreaterThanToken or SyntaxKind.ColonToken) 588static p => p.CurrentToken.Kind != SyntaxKind.CommaToken && !p.IsPossibleSubpatternElement(), 589static (p, closeKind) => p.CurrentToken.Kind == closeKind || p.CurrentToken.Kind == SyntaxKind.SemicolonToken, 601this.EatToken(SyntaxKind.OpenBraceToken), 603this.EatToken(SyntaxKind.CloseBraceToken)); 609while (this.CurrentToken.Kind != SyntaxKind.CloseBraceToken) 615var errantCase = this.CurrentToken.Kind == SyntaxKind.CaseKeyword 634this.CurrentToken.Kind == SyntaxKind.ColonToken 635? this.EatTokenAsKind(SyntaxKind.EqualsGreaterThanToken) 636: this.EatToken(SyntaxKind.EqualsGreaterThanToken), 640if (errantCase is null && switchExpressionCase.FullWidth == 0 && this.CurrentToken.Kind != SyntaxKind.CommaToken) 647if (this.CurrentToken.Kind != SyntaxKind.CloseBraceToken) 649var commaToken = this.CurrentToken.Kind == SyntaxKind.SemicolonToken 650? this.EatTokenAsKind(SyntaxKind.CommaToken) 651: this.EatToken(SyntaxKind.CommaToken); 662var openBracket = this.EatToken(SyntaxKind.OpenBracketToken); 665SyntaxKind.CloseBracketToken, 676this.EatToken(SyntaxKind.CloseBracketToken),
Parser\Lexer.cs (204)
99internal SyntaxKind Kind; 100internal SyntaxKind ContextualKind; 329Debug.Assert(info.Kind != SyntaxKind.IdentifierToken || info.StringValue != null); 343case SyntaxKind.IdentifierToken: 346case SyntaxKind.NumericLiteralToken: 375case SyntaxKind.InterpolatedStringToken: 379case SyntaxKind.StringLiteralToken: 380case SyntaxKind.Utf8StringLiteralToken: 381case SyntaxKind.SingleLineRawStringLiteralToken: 382case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 383case SyntaxKind.MultiLineRawStringLiteralToken: 384case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 387case SyntaxKind.CharacterLiteralToken: 390case SyntaxKind.XmlTextLiteralNewLineToken: 393case SyntaxKind.XmlTextLiteralToken: 396case SyntaxKind.XmlEntityLiteralToken: 399case SyntaxKind.EndOfDocumentationCommentToken: 400case SyntaxKind.EndOfFileToken: 403case SyntaxKind.RazorContentToken: 406case SyntaxKind.None: 428info.Kind = SyntaxKind.None; 429info.ContextualKind = SyntaxKind.None; 447info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.SlashEqualsToken : SyntaxKind.SlashToken; 467info.Kind = SyntaxKind.DotToken; 478info.Kind = SyntaxKind.DotToken; 485info.Kind = SyntaxKind.CommaToken; 490info.Kind = TextWindow.TryAdvance(':') ? SyntaxKind.ColonColonToken : SyntaxKind.ColonToken; 495info.Kind = SyntaxKind.SemicolonToken; 500info.Kind = SyntaxKind.TildeToken; 505info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.ExclamationEqualsToken : SyntaxKind.ExclamationToken; 511TextWindow.TryAdvance('=') ? SyntaxKind.EqualsEqualsToken : 512TextWindow.TryAdvance('>') ? SyntaxKind.EqualsGreaterThanToken : SyntaxKind.EqualsToken; 517info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.AsteriskEqualsToken : SyntaxKind.AsteriskToken; 522info.Kind = SyntaxKind.OpenParenToken; 527info.Kind = SyntaxKind.CloseParenToken; 532info.Kind = SyntaxKind.OpenBraceToken; 537info.Kind = SyntaxKind.CloseBraceToken; 542info.Kind = SyntaxKind.OpenBracketToken; 547info.Kind = SyntaxKind.CloseBracketToken; 553? TextWindow.TryAdvance('=') ? SyntaxKind.QuestionQuestionEqualsToken : SyntaxKind.QuestionQuestionToken 554: SyntaxKind.QuestionToken; 560TextWindow.TryAdvance('=') ? SyntaxKind.PlusEqualsToken : 561TextWindow.TryAdvance('+') ? SyntaxKind.PlusPlusToken : SyntaxKind.PlusToken; 567TextWindow.TryAdvance('=') ? SyntaxKind.MinusEqualsToken : 568TextWindow.TryAdvance('-') ? SyntaxKind.MinusMinusToken : 569TextWindow.TryAdvance('>') ? SyntaxKind.MinusGreaterThanToken : SyntaxKind.MinusToken; 574info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.PercentEqualsToken : SyntaxKind.PercentToken; 580TextWindow.TryAdvance('=') ? SyntaxKind.AmpersandEqualsToken : 581TextWindow.TryAdvance('&') ? SyntaxKind.AmpersandAmpersandToken : SyntaxKind.AmpersandToken; 586info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.CaretEqualsToken : SyntaxKind.CaretToken; 592TextWindow.TryAdvance('=') ? SyntaxKind.BarEqualsToken : 593TextWindow.TryAdvance('|') ? SyntaxKind.BarBarToken : SyntaxKind.BarToken; 599TextWindow.TryAdvance('=') ? SyntaxKind.LessThanEqualsToken : 601? TextWindow.TryAdvance('=') ? SyntaxKind.LessThanLessThanEqualsToken : SyntaxKind.LessThanLessThanToken 602: SyntaxKind.LessThanToken; 607info.Kind = TextWindow.TryAdvance('=') ? SyntaxKind.GreaterThanEqualsToken : SyntaxKind.GreaterThanToken; 620info.Kind = SyntaxKind.RazorContentToken; 685info.Kind = SyntaxKind.EndOfFileToken; 914info.Kind = SyntaxKind.IdentifierToken; 1035info.Kind = SyntaxKind.NumericLiteralToken; 1817info.ContextualKind = SyntaxKind.None; 1828SyntaxKind keywordKind = SyntaxFacts.GetPreprocessorKeywordKind(info.Text); 1832info.Kind = SyntaxKind.IdentifierToken; 1844info.ContextualKind = info.Kind = SyntaxKind.IdentifierToken; 1849info.Kind = SyntaxKind.IdentifierToken; 1853if (info.Kind == SyntaxKind.None) 1855info.Kind = SyntaxKind.IdentifierToken; 1860info.ContextualKind = info.Kind = SyntaxKind.IdentifierToken; 1867info.Kind = SyntaxKind.None; 2368if (directive.Kind == SyntaxKind.EndIfDirectiveTrivia || (branching != null && branching.BranchTaken)) 2372else if (directive.Kind == SyntaxKind.IfDirectiveTrivia) 2477this.LexDirectiveTrailingTrivia(info.Kind == SyntaxKind.EndOfDirectiveToken, ref directiveTriviaCache); 2523var endOfDirective = SyntaxFactory.Token(leading, SyntaxKind.EndOfDirectiveToken, trailing); 2559info.Kind = SyntaxKind.EndOfDirectiveToken; 2565info.Kind = SyntaxKind.EndOfDirectiveToken; 2570info.Kind = SyntaxKind.HashToken; 2575info.Kind = SyntaxKind.OpenParenToken; 2580info.Kind = SyntaxKind.CloseParenToken; 2585info.Kind = SyntaxKind.CommaToken; 2590info.Kind = SyntaxKind.MinusToken; 2595info.Kind = SyntaxKind.ColonToken; 2603info.Kind = SyntaxKind.ExclamationEqualsToken; 2607info.Kind = SyntaxKind.ExclamationToken; 2617info.Kind = SyntaxKind.EqualsEqualsToken; 2621info.Kind = SyntaxKind.EqualsToken; 2630info.Kind = SyntaxKind.AmpersandAmpersandToken; 2640info.Kind = SyntaxKind.BarBarToken; 2657info.Kind = SyntaxKind.NumericLiteralToken; 2705info.Kind = SyntaxKind.None; 2712Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 2713return info.Kind != SyntaxKind.None; 2727else if (tr.Kind == SyntaxKind.EndOfLineTrivia) 2848info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 2856info.Kind = SyntaxKind.XmlEntityLiteralToken; 2874info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 2884info.Kind = SyntaxKind.XmlTextLiteralToken; 2888Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 2889return info.Kind != SyntaxKind.None; 2896info.Kind = SyntaxKind.XmlTextLiteralNewLineToken; 2910info.Kind = SyntaxKind.XmlCommentStartToken; 2921info.Kind = SyntaxKind.XmlCDataStartToken; 2927info.Kind = SyntaxKind.LessThanToken; 2933info.Kind = SyntaxKind.LessThanSlashToken; 2938info.Kind = SyntaxKind.XmlProcessingInstructionStartToken; 2943info.Kind = SyntaxKind.LessThanToken; 3193if (errors == null && tagInfo.ContextualKind == SyntaxKind.None && tagInfo.Kind == SyntaxKind.IdentifierToken) 3215info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3227info.Kind = SyntaxKind.GreaterThanToken; 3234info.Kind = SyntaxKind.SlashGreaterThanToken; 3242info.Kind = SyntaxKind.DoubleQuoteToken; 3247info.Kind = SyntaxKind.SingleQuoteToken; 3252info.Kind = SyntaxKind.EqualsToken; 3257info.Kind = SyntaxKind.ColonToken; 3271info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3289info.Kind = SyntaxKind.IdentifierToken; 3299info.Kind = SyntaxKind.None; 3306Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 3307return info.Kind != SyntaxKind.None; 3388info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3399info.Kind = SyntaxKind.DoubleQuoteToken; 3409info.Kind = SyntaxKind.SingleQuoteToken; 3417info.Kind = SyntaxKind.XmlEntityLiteralToken; 3422info.Kind = SyntaxKind.LessThanToken; 3436info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3446info.Kind = SyntaxKind.XmlTextLiteralToken; 3450Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 3451return info.Kind != SyntaxKind.None; 3546info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3554info.Kind = SyntaxKind.XmlEntityLiteralToken; 3561info.Kind = SyntaxKind.EndOfFileToken; 3564info.Kind = SyntaxKind.XmlTextLiteralToken; 3606info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3621info.Kind = SyntaxKind.DoubleQuoteToken; 3630info.Kind = SyntaxKind.SingleQuoteToken; 3647info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 3662info.Kind = SyntaxKind.XmlEntityLiteralToken; 3699info.Kind = SyntaxKind.OpenParenToken; 3702info.Kind = SyntaxKind.CloseParenToken; 3705info.Kind = SyntaxKind.OpenBracketToken; 3708info.Kind = SyntaxKind.CloseBracketToken; 3711info.Kind = SyntaxKind.CommaToken; 3722info.Kind = SyntaxKind.DotDotToken; 3726info.Kind = SyntaxKind.DotToken; 3730info.Kind = SyntaxKind.QuestionToken; 3733info.Kind = SyntaxKind.AmpersandToken; 3736info.Kind = SyntaxKind.AsteriskToken; 3739info.Kind = SyntaxKind.BarToken; 3742info.Kind = SyntaxKind.CaretToken; 3745info.Kind = SyntaxKind.PercentToken; 3748info.Kind = SyntaxKind.SlashToken; 3751info.Kind = SyntaxKind.TildeToken; 3756info.Kind = SyntaxKind.LessThanToken; 3759info.Kind = SyntaxKind.GreaterThanToken; 3764if (AdvanceIfMatches(':')) info.Kind = SyntaxKind.ColonColonToken; 3765else info.Kind = SyntaxKind.ColonToken; 3768if (AdvanceIfMatches('=')) info.Kind = SyntaxKind.EqualsEqualsToken; 3769else info.Kind = SyntaxKind.EqualsToken; 3772if (AdvanceIfMatches('=')) info.Kind = SyntaxKind.ExclamationEqualsToken; 3773else info.Kind = SyntaxKind.ExclamationToken; 3776if (AdvanceIfMatches('=')) info.Kind = SyntaxKind.GreaterThanEqualsToken; 3778else info.Kind = SyntaxKind.GreaterThanToken; 3781if (AdvanceIfMatches('=')) info.Kind = SyntaxKind.LessThanEqualsToken; 3782else if (AdvanceIfMatches('<')) info.Kind = SyntaxKind.LessThanLessThanToken; 3783else info.Kind = SyntaxKind.LessThanToken; 3786if (AdvanceIfMatches('+')) info.Kind = SyntaxKind.PlusPlusToken; 3787else info.Kind = SyntaxKind.PlusToken; 3790if (AdvanceIfMatches('-')) info.Kind = SyntaxKind.MinusMinusToken; 3791else info.Kind = SyntaxKind.MinusToken; 3795if (info.Kind != SyntaxKind.None) 3822SyntaxKind keywordKind; 3827info.Kind = SyntaxKind.IdentifierToken; 3839info.ContextualKind = info.Kind = SyntaxKind.IdentifierToken; 3857info.Kind = SyntaxKind.IdentifierToken; 3864info.Kind = SyntaxKind.XmlEntityLiteralToken; 3886Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 3887return info.Kind != SyntaxKind.None; 4012info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4022info.Kind = SyntaxKind.XmlCDataEndToken; 4039info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4049info.Kind = SyntaxKind.XmlTextLiteralToken; 4134info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4146info.Kind = SyntaxKind.XmlCommentEndToken; 4152info.Kind = SyntaxKind.MinusMinusToken; 4169info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4179info.Kind = SyntaxKind.XmlTextLiteralToken; 4265info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4275info.Kind = SyntaxKind.XmlProcessingInstructionEndToken; 4292info.Kind = SyntaxKind.EndOfDocumentationCommentToken; 4302info.Kind = SyntaxKind.XmlTextLiteralToken;
Parser\Lexer_RawStringLiteral.cs (8)
73Debug.Assert(info.Kind is (SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken)); 79case SyntaxKind.SingleLineRawStringLiteralToken: 80info.Kind = SyntaxKind.Utf8SingleLineRawStringLiteralToken; 83case SyntaxKind.MultiLineRawStringLiteralToken: 84info.Kind = SyntaxKind.Utf8MultiLineRawStringLiteralToken; 103info.Kind = SyntaxKind.SingleLineRawStringLiteralToken; 135info.Kind = SyntaxKind.MultiLineRawStringLiteralToken;
Parser\Lexer_StringLiteral.cs (9)
28info.Kind = SyntaxKind.StringLiteralToken; 77info.Kind = SyntaxKind.CharacterLiteralToken; 98info.Kind = SyntaxKind.Utf8StringLiteralToken; 102info.Kind = SyntaxKind.StringLiteralToken; 243info.Kind = SyntaxKind.Utf8StringLiteralToken; 247info.Kind = SyntaxKind.StringLiteralToken; 294info.Kind = SyntaxKind.InterpolatedStringToken; 305var kind = SyntaxKind.InterpolatedStringToken;
Parser\LexerCache.cs (9)
20private static readonly ObjectPool<CachingIdentityFactory<string, SyntaxKind>> s_keywordKindPool = 21CachingIdentityFactory<string, SyntaxKind>.CreatePool( 25var kind = SyntaxFacts.GetKeywordKind(key); 26if (kind == SyntaxKind.None) 36private CachingIdentityFactory<string, SyntaxKind>? _keywordKindMap; 134private CachingIdentityFactory<string, SyntaxKind> KeywordKindMap 174internal bool TryGetKeywordKind(string key, out SyntaxKind kind) 178kind = SyntaxKind.None; 183return kind != SyntaxKind.None;
Parser\SyntaxParser.cs (30)
151if (token.Kind == SyntaxKind.EndOfFileToken) 271protected SyntaxKind CurrentNodeKind 276return cn != null ? cn.Kind() : SyntaxKind.None; 497protected SyntaxToken TryEatToken(SyntaxKind kind) 516_currentToken = SyntaxFactory.Token(SyntaxKind.EndOfFileToken); 521protected SyntaxToken EatToken(SyntaxKind kind) 537protected SyntaxToken EatTokenAsKind(SyntaxKind expected) 552protected SyntaxToken CreateMissingToken(SyntaxKind expected, SyntaxKind actual) 558private SyntaxToken CreateMissingToken(SyntaxKind expected, ErrorCode code, bool reportError) 570protected SyntaxToken EatToken(SyntaxKind kind, bool reportError) 589protected SyntaxToken EatToken(SyntaxKind kind, ErrorCode code, bool reportError = true) 609protected SyntaxToken EatTokenEvenWithIncorrectKind(SyntaxKind kind) 631if (triviaList.Any((int)SyntaxKind.EndOfLineTrivia)) 645protected SyntaxToken EatContextualToken(SyntaxKind kind, ErrorCode code) 659protected SyntaxToken EatContextualToken(SyntaxKind kind) 663var contextualKind = this.CurrentToken.ContextualKind; 674protected virtual SyntaxDiagnosticInfo GetExpectedTokenError(SyntaxKind expected, SyntaxKind actual, int offset, int width) 692GreenNode missingNodeOrToken, SyntaxKind expected, SyntaxKind actual) 700private static ErrorCode GetExpectedTokenErrorCode(SyntaxKind expected, SyntaxKind actual) 704case SyntaxKind.IdentifierToken: 714case SyntaxKind.SemicolonToken: 719case SyntaxKind.CloseParenToken: 721case SyntaxKind.OpenBraceToken: 723case SyntaxKind.CloseBraceToken: 767Debug.Assert(nodeOrToken.Width > 0 || nodeOrToken.RawKind is (int)SyntaxKind.EndOfFileToken); 819if (triviaList.Any((int)SyntaxKind.EndOfLineTrivia))
src\roslyn\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (38)
74case SyntaxKind.NamespaceDeclaration: 75case SyntaxKind.FileScopedNamespaceDeclaration: 88while (name.Kind() == SyntaxKind.QualifiedName) 98case SyntaxKind.ClassDeclaration: 99case SyntaxKind.StructDeclaration: 100case SyntaxKind.RecordDeclaration: 101case SyntaxKind.RecordStructDeclaration: 121goto case SyntaxKind.InterfaceDeclaration; 123case SyntaxKind.InterfaceDeclaration: 124case SyntaxKind.ExtensionBlockDeclaration: 142case SyntaxKind.EnumDeclaration: 158case SyntaxKind.EnumMemberDeclaration: 170case SyntaxKind.DelegateDeclaration: 184case SyntaxKind.EventDeclaration: 202case SyntaxKind.EventFieldDeclaration: 203case SyntaxKind.FieldDeclaration: 222case SyntaxKind.ArrowExpressionClause: 233case SyntaxKind.PropertyDeclaration: 258case SyntaxKind.IndexerDeclaration: 284case SyntaxKind.AddAccessorDeclaration: 285case SyntaxKind.RemoveAccessorDeclaration: 286case SyntaxKind.GetAccessorDeclaration: 287case SyntaxKind.SetAccessorDeclaration: 288case SyntaxKind.InitAccessorDeclaration: 301case SyntaxKind.ConstructorDeclaration: 302case SyntaxKind.ConversionOperatorDeclaration: 303case SyntaxKind.DestructorDeclaration: 304case SyntaxKind.MethodDeclaration: 305case SyntaxKind.OperatorDeclaration: 336case SyntaxKind.CompilationUnit: 438case SyntaxKind.ArrowExpressionClause: 441case SyntaxKind.MethodDeclaration: 444case SyntaxKind.OperatorDeclaration: 447case SyntaxKind.ConversionOperatorDeclaration: 450case SyntaxKind.PropertyDeclaration: 453case SyntaxKind.IndexerDeclaration: 456case SyntaxKind.ConstructorDeclaration: 459case SyntaxKind.DestructorDeclaration:
SymbolDisplay\SymbolDisplayVisitor.cs (24)
141SyntaxKind kind = SyntaxFacts.GetKeywordKind(identifier); 143if (kind is SyntaxKind.None && isNamedTypeOrAliasName && StringComparer.Ordinal.Equals(identifier, "record")) 145kind = SyntaxKind.RecordKeyword; 148return kind == SyntaxKind.None ? identifier : $"@{identifier}"; 180AddKeyword(SyntaxKind.NamespaceKeyword); 190AddPunctuation(containingNamespace.IsGlobalNamespace ? SyntaxKind.ColonColonToken : SyntaxKind.DotToken); 224SyntaxFacts.GetText(SyntaxKind.GlobalKeyword))); 247AddKeyword(SyntaxKind.ScopedKeyword); 251AddKeyword(SyntaxKind.RefKeyword); 256AddKeyword(SyntaxKind.ReadOnlyKeyword); 262AddKeyword(SyntaxKind.ScopedKeyword); 288AddPunctuation(SyntaxKind.EqualsToken); 339AddPunctuation(SyntaxKind.EqualsToken); 356private void AddPunctuation(SyntaxKind punctuationKind) 361private void AddKeyword(SyntaxKind keywordKind) 396AddKeyword(SyntaxKind.PrivateKeyword); 399AddKeyword(SyntaxKind.InternalKeyword); 402AddKeyword(SyntaxKind.PrivateKeyword); 404AddKeyword(SyntaxKind.ProtectedKeyword); 407AddKeyword(SyntaxKind.ProtectedKeyword); 410AddKeyword(SyntaxKind.ProtectedKeyword); 412AddKeyword(SyntaxKind.InternalKeyword); 415AddKeyword(SyntaxKind.PublicKeyword);
SymbolDisplay\SymbolDisplayVisitor.Members.cs (95)
59AddPunctuation(SyntaxKind.DotToken); 67AddPunctuation(SyntaxKind.DotToken); 68AddKeyword(SyntaxKind.FieldKeyword); 90AddPunctuation(SyntaxKind.EqualsToken); 175AddPunctuation(SyntaxKind.DotToken); 183AddPunctuation(SyntaxKind.OpenBraceToken); 185AddAccessor(symbol, symbol.GetMethod, SyntaxKind.GetKeyword); 186var keywordForSetAccessor = IsInitOnly(symbol.SetMethod) ? SyntaxKind.InitKeyword : SyntaxKind.SetKeyword; 190AddPunctuation(SyntaxKind.CloseBraceToken); 210AddKeyword(SyntaxKind.ThisKeyword); 224AddPunctuation(SyntaxKind.OpenBracketToken); 226AddPunctuation(SyntaxKind.CloseBracketToken); 243AddKeyword(SyntaxKind.EventKeyword); 257AddPunctuation(SyntaxKind.DotToken); 344tryGetUserDefinedOperatorTokenKind(symbol.MetadataName) == SyntaxKind.None) 368AddKeyword(SyntaxKind.VoidKeyword); 415AddPunctuation(SyntaxKind.DotToken); 448AddPunctuation(SyntaxKind.DotToken); 449AddKeyword(symbol.MethodKind == MethodKind.PropertyGet ? SyntaxKind.GetKeyword : 450IsInitOnly(symbol) ? SyntaxKind.InitKeyword : SyntaxKind.SetKeyword); 463AddPunctuation(SyntaxKind.DotToken); 464AddKeyword(symbol.MethodKind == MethodKind.EventAdd ? SyntaxKind.AddKeyword : SyntaxKind.RemoveKeyword); 494AddPunctuation(SyntaxKind.TildeToken); 538SyntaxKind operatorKind = tryGetUserDefinedOperatorTokenKind(symbol.MetadataName); 540if (operatorKind == SyntaxKind.None) 559SyntaxKind conversionKind = tryGetUserDefinedConversionTokenKind(symbol.MetadataName); 561if (conversionKind == SyntaxKind.None) 585AddKeyword(SyntaxKind.DelegateKeyword); 586AddPunctuation(SyntaxKind.AsteriskToken); 591AddKeyword(SyntaxKind.UnmanagedKeyword); 597AddPunctuation(SyntaxKind.OpenBracketToken); 621AddPunctuation(SyntaxKind.CommaToken); 634AddPunctuation(SyntaxKind.CloseBracketToken); 638AddPunctuation(SyntaxKind.LessThanToken); 650AddPunctuation(SyntaxKind.CommaToken); 669AddPunctuation(SyntaxKind.GreaterThanToken); 672static SyntaxKind tryGetUserDefinedOperatorTokenKind(string operatorName) 676return SyntaxKind.TrueKeyword; 680return SyntaxKind.FalseKeyword; 688void addUserDefinedOperatorName(IMethodSymbol symbol, SyntaxKind operatorKind, string operatorName) 690Debug.Assert(operatorKind != SyntaxKind.None); 692AddKeyword(SyntaxKind.OperatorKeyword); 695if (operatorKind == SyntaxKind.TrueKeyword) 697AddKeyword(SyntaxKind.TrueKeyword); 699else if (operatorKind == SyntaxKind.FalseKeyword) 701AddKeyword(SyntaxKind.FalseKeyword); 707AddKeyword(SyntaxKind.CheckedKeyword); 716static SyntaxKind tryGetUserDefinedConversionTokenKind(string operatorName) 720return SyntaxKind.ExplicitKeyword; 724return SyntaxKind.ImplicitKeyword; 728return SyntaxKind.None; 732void addUserDefinedConversionName(IMethodSymbol symbol, SyntaxKind conversionKind, string operatorName) 736Debug.Assert(conversionKind != SyntaxKind.None); 740AddKeyword(SyntaxKind.OperatorKeyword); 745AddKeyword(SyntaxKind.CheckedKeyword); 781AddPunctuation(SyntaxKind.OpenParenToken); 786AddPunctuation(SyntaxKind.CloseParenToken); 809AddPunctuation(SyntaxKind.OpenBracketToken); 833AddPunctuation(SyntaxKind.EqualsToken); 841AddPunctuation(SyntaxKind.CloseBracketToken); 855AddKeyword(SyntaxKind.ScopedKeyword); 868AddKeyword(SyntaxKind.ParamsKeyword); 876AddKeyword(SyntaxKind.ScopedKeyword); 907AddKeyword(SyntaxKind.ConstKeyword); 913AddKeyword(SyntaxKind.ReadOnlyKeyword); 919AddKeyword(SyntaxKind.VolatileKeyword); 942AddKeyword(SyntaxKind.StaticKeyword); 948AddKeyword(SyntaxKind.OverrideKeyword); 954AddKeyword(SyntaxKind.AbstractKeyword); 960AddKeyword(SyntaxKind.SealedKeyword); 966AddKeyword(SyntaxKind.ExternKeyword); 972AddKeyword(SyntaxKind.VirtualKeyword); 978AddKeyword(SyntaxKind.RequiredKeyword); 1003AddPunctuation(SyntaxKind.CommaToken); 1010AddKeyword(SyntaxKind.ThisKeyword); 1024AddPunctuation(SyntaxKind.CommaToken); 1028AddKeyword(SyntaxKind.ArgListKeyword); 1032private void AddAccessor(IPropertySymbol property, IMethodSymbol? method, SyntaxKind keyword) 1048AddPunctuation(SyntaxKind.SemicolonToken); 1063AddPunctuation(SyntaxKind.DotToken); 1082AddPunctuation(SyntaxKind.OpenParenToken); 1084AddPunctuation(SyntaxKind.CloseParenToken); 1103AddKeyword(SyntaxKind.RefKeyword); 1117AddKeyword(SyntaxKind.RefKeyword); 1119AddKeyword(SyntaxKind.ReadOnlyKeyword); 1129AddKeyword(SyntaxKind.ReadOnlyKeyword); 1139AddKeyword(SyntaxKind.OutKeyword); 1143AddKeyword(SyntaxKind.RefKeyword); 1147AddKeyword(SyntaxKind.InKeyword); 1151AddKeyword(SyntaxKind.RefKeyword); 1153AddKeyword(SyntaxKind.ReadOnlyKeyword);
SymbolDisplay\SymbolDisplayVisitor.Types.cs (61)
73AddPunctuation(type.NullableAnnotation == CodeAnalysis.NullableAnnotation.Annotated ? SyntaxKind.QuestionToken : SyntaxKind.ExclamationToken); 106AddPunctuation(SyntaxKind.OpenBracketToken); 112AddPunctuation(SyntaxKind.AsteriskToken); 120AddPunctuation(SyntaxKind.AsteriskToken); 126AddPunctuation(SyntaxKind.CommaToken); 130AddPunctuation(SyntaxKind.AsteriskToken); 134AddPunctuation(SyntaxKind.CloseBracketToken); 147AddPunctuation(SyntaxKind.AsteriskToken); 236AddPunctuation(SyntaxKind.QuestionToken); 270AddKeyword(SyntaxKind.VoidKeyword); 291AddPunctuation(namespaceSymbol.IsGlobalNamespace ? SyntaxKind.ColonColonToken : SyntaxKind.DotToken); 312AddPunctuation(Format.CompilerInternalOptions.HasFlag(SymbolDisplayCompilerInternalOptions.UsePlusForNestedTypes) ? SyntaxKind.PlusToken : SyntaxKind.DotToken); 349AddKeyword(SyntaxKind.ExtensionKeyword); 423AddPunctuation(SyntaxKind.LessThanToken); 426AddPunctuation(SyntaxKind.CommaToken); 429AddPunctuation(SyntaxKind.GreaterThanToken); 459AddPunctuation(SyntaxKind.OpenBracketToken); 461AddPunctuation(SyntaxKind.CloseBracketToken); 471AddPunctuation(SyntaxKind.OpenParenToken); 473AddPunctuation(SyntaxKind.CloseParenToken); 500AddPunctuation(SyntaxKind.OpenParenToken); 502AddPunctuation(SyntaxKind.CloseParenToken); 594AddPunctuation(SyntaxKind.OpenParenToken); 601AddPunctuation(SyntaxKind.CommaToken); 613AddPunctuation(SyntaxKind.CloseParenToken); 619AddPunctuation(SyntaxKind.OpenBracketToken); 621AddPunctuation(SyntaxKind.CloseBracketToken); 744AddKeyword(SyntaxKind.RecordKeyword); 754AddKeyword(SyntaxKind.ReadOnlyKeyword); 758AddKeyword(SyntaxKind.RecordKeyword); 760AddKeyword(SyntaxKind.StructKeyword); 766AddKeyword(SyntaxKind.ClassKeyword); 771AddKeyword(SyntaxKind.EnumKeyword); 776AddKeyword(SyntaxKind.DelegateKeyword); 781AddKeyword(SyntaxKind.InterfaceKeyword); 788AddKeyword(SyntaxKind.ReadOnlyKeyword); 794AddKeyword(SyntaxKind.RefKeyword); 798AddKeyword(SyntaxKind.StructKeyword); 813AddKeyword(SyntaxKind.InKeyword); 817AddKeyword(SyntaxKind.OutKeyword); 840AddPunctuation(SyntaxKind.LessThanToken); 849AddPunctuation(SyntaxKind.CommaToken); 877AddPunctuation(SyntaxKind.GreaterThanToken); 901AddKeyword(SyntaxKind.WhereKeyword); 907AddPunctuation(SyntaxKind.ColonToken); 915AddKeyword(SyntaxKind.ClassKeyword); 922AddPunctuation(SyntaxKind.QuestionToken); 929AddPunctuation(SyntaxKind.ExclamationToken); 943AddKeyword(SyntaxKind.StructKeyword); 957AddPunctuation(SyntaxKind.CommaToken); 970AddPunctuation(SyntaxKind.CommaToken); 974AddKeyword(SyntaxKind.NewKeyword); 975AddPunctuation(SyntaxKind.OpenParenToken); 976AddPunctuation(SyntaxKind.CloseParenToken); 984AddPunctuation(SyntaxKind.CommaToken); 988AddKeyword(SyntaxKind.AllowsKeyword); 990AddKeyword(SyntaxKind.RefKeyword); 992AddKeyword(SyntaxKind.StructKeyword);
SymbolDisplay\SymbolDisplayVisitor_Constants.cs (7)
20AddKeyword(SyntaxKind.NullKeyword); 24AddKeyword(SyntaxKind.DefaultKeyword); 27AddPunctuation(SyntaxKind.OpenParenToken); 29AddPunctuation(SyntaxKind.CloseParenToken); 36AddPunctuation(SyntaxKind.OpenParenToken); 38AddPunctuation(SyntaxKind.CloseParenToken); 66AddPunctuation(SyntaxKind.BarToken);
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (8)
56return SyntaxFacts.IsInNamespaceOrTypeContext(startNode as ExpressionSyntax) || token.IsKind(SyntaxKind.NewKeyword) || this.InNamespaceOrType; 102AddPunctuation(SyntaxKind.ColonColonToken); 108AddPunctuation(SyntaxKind.DotToken); 140AddPunctuation(SyntaxKind.DotToken); 155AddKeyword(SyntaxKind.GlobalKeyword); 156AddPunctuation(SyntaxKind.ColonColonToken); 162AddPunctuation(SyntaxKind.DotToken); 295if (token.IsKind(SyntaxKind.IdentifierToken))
Symbols\FieldOrPropertyInitializer.cs (2)
31Debug.Assert(((syntax.IsKind(SyntaxKind.EqualsValueClause) || syntax.IsKind(SyntaxKind.Parameter)) && fieldOpt != null) || syntax is StatementSyntax);
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (5)
44case SyntaxKind.RefKeyword when refKind == RefKind.None: 45if (modifiers.Count > i + 1 && modifiers[i + 1].Kind() == SyntaxKind.ReadOnlyKeyword) 58case SyntaxKind.RefKeyword: 115case SyntaxKind.ManagedKeyword: 123case SyntaxKind.UnmanagedKeyword:
Symbols\MemberSymbolExtensions.cs (1)
627if (constructorSyntax?.Initializer?.Kind() == SyntaxKind.ThisConstructorInitializer)
Symbols\NamespaceOrTypeSymbol.cs (1)
210SyntaxKind kind,
Symbols\NamespaceSymbol.cs (4)
294case SyntaxKind.GenericName: // DeclarationTreeBuilder.VisitNamespace uses the PlainName, even for generic names 295case SyntaxKind.IdentifierName: 298case SyntaxKind.QualifiedName: 308case SyntaxKind.AliasQualifiedName:
Symbols\RangeVariableSymbol.cs (1)
63Debug.Assert(token.Kind() == SyntaxKind.IdentifierToken);
Symbols\RefKindExtensions.cs (5)
21public static RefKind GetRefKind(this SyntaxKind syntaxKind) 25case SyntaxKind.RefKeyword: 27case SyntaxKind.OutKeyword: 29case SyntaxKind.InKeyword: 31case SyntaxKind.None:
Symbols\Source\AttributeLocation.cs (2)
113var kind = SyntaxFacts.GetKeywordKind(token.ValueText); 114if (kind == SyntaxKind.None)
Symbols\Source\GlobalExpressionVariable.cs (4)
52Debug.Assert(nodeToBind.Kind() == SyntaxKind.VariableDeclarator || nodeToBind is ExpressionSyntax); 179Debug.Assert(nodeToBind.Kind() == SyntaxKind.VariableDeclarator || nodeToBind is ExpressionSyntax); 189if ((object)_containingFieldOpt != null && nodeToBind.Kind() != SyntaxKind.VariableDeclarator) 200case SyntaxKind.VariableDeclarator:
Symbols\Source\LambdaSymbol.cs (1)
382var isParams = paramSyntax?.Modifiers.Any(static m => m.IsKind(SyntaxKind.ParamsKeyword)) ?? false;
Symbols\Source\LocalFunctionSymbol.cs (3)
220var isVararg = arglistToken.Kind() == SyntaxKind.ArgListKeyword; 337firstParam.Modifiers.Any(SyntaxKind.ThisKeyword); 445if (parameter.VarianceKeyword.Kind() != SyntaxKind.None)
Symbols\Source\ModifierUtils.cs (58)
29var readonlyToken = modifiers.FirstOrDefault(SyntaxKind.ReadOnlyKeyword); 123Debug.Assert(modifier.Kind() == SyntaxKind.ScopedKeyword); 136var partialToken = modifierTokens.Value.FirstOrDefault(SyntaxKind.PartialKeyword); 307return SyntaxFacts.GetText(SyntaxKind.AbstractKeyword); 309return SyntaxFacts.GetText(SyntaxKind.SealedKeyword); 311return SyntaxFacts.GetText(SyntaxKind.StaticKeyword); 313return SyntaxFacts.GetText(SyntaxKind.NewKeyword); 315return SyntaxFacts.GetText(SyntaxKind.PublicKeyword); 317return SyntaxFacts.GetText(SyntaxKind.ProtectedKeyword); 319return SyntaxFacts.GetText(SyntaxKind.InternalKeyword); 321return SyntaxFacts.GetText(SyntaxKind.ProtectedKeyword) + " " + SyntaxFacts.GetText(SyntaxKind.InternalKeyword); 323return SyntaxFacts.GetText(SyntaxKind.PrivateKeyword); 325return SyntaxFacts.GetText(SyntaxKind.PrivateKeyword) + " " + SyntaxFacts.GetText(SyntaxKind.ProtectedKeyword); 327return SyntaxFacts.GetText(SyntaxKind.ReadOnlyKeyword); 329return SyntaxFacts.GetText(SyntaxKind.ConstKeyword); 331return SyntaxFacts.GetText(SyntaxKind.VolatileKeyword); 333return SyntaxFacts.GetText(SyntaxKind.ExternKeyword); 335return SyntaxFacts.GetText(SyntaxKind.PartialKeyword); 337return SyntaxFacts.GetText(SyntaxKind.UnsafeKeyword); 339return SyntaxFacts.GetText(SyntaxKind.FixedKeyword); 341return SyntaxFacts.GetText(SyntaxKind.VirtualKeyword); 343return SyntaxFacts.GetText(SyntaxKind.OverrideKeyword); 345return SyntaxFacts.GetText(SyntaxKind.AsyncKeyword); 347return SyntaxFacts.GetText(SyntaxKind.RefKeyword); 349return SyntaxFacts.GetText(SyntaxKind.RequiredKeyword); 351return SyntaxFacts.GetText(SyntaxKind.ScopedKeyword); 353return SyntaxFacts.GetText(SyntaxKind.FileKeyword); 355return SyntaxFacts.GetText(SyntaxKind.ClosedKeyword); 361private static DeclarationModifiers ToDeclarationModifier(SyntaxKind kind) 365case SyntaxKind.AbstractKeyword: 367case SyntaxKind.AsyncKeyword: 369case SyntaxKind.SealedKeyword: 371case SyntaxKind.StaticKeyword: 373case SyntaxKind.NewKeyword: 375case SyntaxKind.PublicKeyword: 377case SyntaxKind.ProtectedKeyword: 379case SyntaxKind.InternalKeyword: 381case SyntaxKind.PrivateKeyword: 383case SyntaxKind.ExternKeyword: 385case SyntaxKind.ReadOnlyKeyword: 387case SyntaxKind.PartialKeyword: 389case SyntaxKind.UnsafeKeyword: 391case SyntaxKind.VirtualKeyword: 393case SyntaxKind.OverrideKeyword: 395case SyntaxKind.ConstKeyword: 397case SyntaxKind.FixedKeyword: 399case SyntaxKind.VolatileKeyword: 401case SyntaxKind.RefKeyword: 403case SyntaxKind.RequiredKeyword: 405case SyntaxKind.ScopedKeyword: 407case SyntaxKind.FileKeyword: 409case SyntaxKind.ClosedKeyword: 452var i = modifiers.IndexOf(SyntaxKind.PartialKeyword); 462var isPartialAsyncMethod = isOrdinaryMethod && i == modifiers.Count - 2 && modifiers[i + 1].ContextualKind() is SyntaxKind.AsyncKeyword; 621var keyword = modifiers.FirstOrDefault(SyntaxKind.UnsafeKeyword) is { } unsafeKeyword && unsafeKeyword != default 623: modifiers.FirstOrDefault(SyntaxKind.ExternKeyword);
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) 1743diagnostics.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)
278if (arglistToken.Kind() == SyntaxKind.ArgListKeyword)
Symbols\Source\SourceEventSymbol.cs (4)
162case SyntaxKind.EventDeclaration: 164case SyntaxKind.VariableDeclarator: 664diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword)); 669diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.VirtualKeyword));
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) 2496diagnostics.Add(ErrorCode.ERR_MemberAlreadyExists, indexer.GetFirstLocation(), SyntaxFacts.GetText(SyntaxKind.ThisKeyword), containerForDiagnostics); 3205case SyntaxKind.FieldDeclaration: 3208!ContainsModifier(fieldDecl.Modifiers, SyntaxKind.StaticKeyword) && 3209!ContainsModifier(fieldDecl.Modifiers, SyntaxKind.ConstKeyword); 3210case SyntaxKind.PropertyDeclaration: 3214!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.StaticKeyword) && 3215!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.AbstractKeyword) && 3216!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.ExternKeyword) && 3217!ContainsModifier(propertyDecl.Modifiers, SyntaxKind.PartialKeyword) && 3220case SyntaxKind.EventFieldDeclaration: 3224!ContainsModifier(eventFieldDecl.Modifiers, SyntaxKind.StaticKeyword) && 3225!ContainsModifier(eventFieldDecl.Modifiers, SyntaxKind.AbstractKeyword) && 3226!ContainsModifier(eventFieldDecl.Modifiers, SyntaxKind.ExternKeyword); 3239private static bool ContainsModifier(SyntaxTokenList modifiers, SyntaxKind modifier) 4027case SyntaxKind.EnumDeclaration: 4031case SyntaxKind.DelegateDeclaration: 4035case SyntaxKind.NamespaceDeclaration: 4036case SyntaxKind.FileScopedNamespaceDeclaration: 4041case SyntaxKind.CompilationUnit: 4045case SyntaxKind.InterfaceDeclaration: 4049case SyntaxKind.ClassDeclaration: 4050case SyntaxKind.StructDeclaration: 4051case SyntaxKind.UnionDeclaration: 4052case SyntaxKind.RecordDeclaration: 4053case SyntaxKind.RecordStructDeclaration: 4054case SyntaxKind.ExtensionBlockDeclaration: 4080if (syntax.Kind() is SyntaxKind.UnionDeclaration) 4868&& type.Kind() is (SyntaxKind.RecordStructDeclaration or SyntaxKind.StructDeclaration or SyntaxKind.UnionDeclaration)); 5756case SyntaxKind.FieldDeclaration: 5802case SyntaxKind.MethodDeclaration: 5815case SyntaxKind.ConstructorDeclaration: 5826if (constructorSyntax.Initializer?.Kind() != SyntaxKind.ThisConstructorInitializer) 5833case SyntaxKind.DestructorDeclaration: 5850case SyntaxKind.PropertyDeclaration: 5900case SyntaxKind.EventFieldDeclaration: 5952case SyntaxKind.EventDeclaration: 5971case SyntaxKind.IndexerDeclaration: 5987case SyntaxKind.ConversionOperatorDeclaration: 6001case SyntaxKind.OperatorDeclaration: 6015case SyntaxKind.GlobalStatement: 6024while (innerStatement.Kind() == SyntaxKind.LabeledStatement) 6031case SyntaxKind.LocalDeclarationStatement: 6043case SyntaxKind.ExpressionStatement: 6044case SyntaxKind.IfStatement: 6045case SyntaxKind.YieldReturnStatement: 6046case SyntaxKind.ReturnStatement: 6047case SyntaxKind.ThrowStatement: 6048case SyntaxKind.SwitchStatement: 6049case SyntaxKind.LockStatement: 6074m.Kind() is SyntaxKind.NamespaceDeclaration or 6075SyntaxKind.FileScopedNamespaceDeclaration or 6076SyntaxKind.IncompleteMember); 6089var errorCode = parentSyntax.IsKind(SyntaxKind.CompilationUnit)
Symbols\Source\SourceMemberFieldSymbol.cs (5)
81if (modifier.Kind() == SyntaxKind.ConstKeyword) 87Debug.Assert(constToken.Kind() == SyntaxKind.ConstKeyword); 209if (modifier.IsKind(SyntaxKind.FixedKeyword)) 247diagnostics.Add(ErrorCode.ERR_BadMemberFlag, errorLocation, SyntaxFacts.GetText(SyntaxKind.RequiredKeyword)); 467diagnostics.Add(ErrorCode.ERR_BadMemberFlag, ErrorLocation, SyntaxFacts.GetText(SyntaxKind.ScopedKeyword));
Symbols\Source\SourceMemberMethodSymbol.cs (2)
742Debug.Assert(arrowExpression.Parent.Kind() == SyntaxKind.PropertyDeclaration || 743arrowExpression.Parent.Kind() == SyntaxKind.IndexerDeclaration ||
Symbols\Source\SourceMethodSymbol.cs (3)
291SyntaxKind syntaxKind = SyntaxFacts.GetOperatorKind(target.Name); 293return syntaxKind is (SyntaxKind.PlusPlusToken or SyntaxKind.MinusMinusToken) ||
Symbols\Source\SourceMethodSymbolWithAttributes.cs (3)
53Debug.Assert(arrowExpression.Parent!.Kind() == SyntaxKind.PropertyDeclaration || 54arrowExpression.Parent.Kind() == SyntaxKind.IndexerDeclaration); 61Debug.Assert(recordDecl.IsKind(SyntaxKind.RecordDeclaration));
Symbols\Source\SourceNamedTypeSymbol.cs (29)
118case SyntaxKind.EnumDeclaration: 120case SyntaxKind.DelegateDeclaration: 122case SyntaxKind.ClassDeclaration: 123case SyntaxKind.InterfaceDeclaration: 124case SyntaxKind.StructDeclaration: 125case SyntaxKind.UnionDeclaration: 126case SyntaxKind.RecordDeclaration: 127case SyntaxKind.RecordStructDeclaration: 162SyntaxKind typeKind = typeDecl.Kind(); 165case SyntaxKind.ClassDeclaration: 166case SyntaxKind.StructDeclaration: 167case SyntaxKind.UnionDeclaration: 168case SyntaxKind.InterfaceDeclaration: 169case SyntaxKind.RecordDeclaration: 170case SyntaxKind.RecordStructDeclaration: 171case SyntaxKind.ExtensionBlockDeclaration: 175case SyntaxKind.DelegateDeclaration: 179case SyntaxKind.EnumDeclaration: 187bool isInterfaceOrDelegate = typeKind == SyntaxKind.InterfaceDeclaration || typeKind == SyntaxKind.DelegateDeclaration; 193if (tp.VarianceKeyword.Kind() != SyntaxKind.None) 476case SyntaxKind.ClassDeclaration: 477case SyntaxKind.StructDeclaration: 478case SyntaxKind.UnionDeclaration: 479case SyntaxKind.InterfaceDeclaration: 480case SyntaxKind.RecordDeclaration: 481case SyntaxKind.RecordStructDeclaration: 482case SyntaxKind.ExtensionBlockDeclaration: 486case SyntaxKind.DelegateDeclaration:
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (1)
515if (typeSyntax.Kind() != SyntaxKind.PredefinedType && !SyntaxFacts.IsName(typeSyntax.Kind()))
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (2)
542if (SyntaxFacts.GetKeywordKind(name) != SyntaxKind.None 543|| SyntaxFacts.GetContextualKeywordKind(name) != SyntaxKind.None
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (3)
497if (aliasSyntax.Identifier.ContextualKind() == SyntaxKind.GlobalKeyword) 654if (applyIsGlobalFilter.HasValue && usingDirective.GlobalKeyword.IsKind(SyntaxKind.GlobalKeyword) != applyIsGlobalFilter.GetValueOrDefault()) 666if (identifier.ContextualKind() == SyntaxKind.GlobalKeyword)
Symbols\Source\SourceOrdinaryMethodSymbol.cs (8)
43return explicitInterfaceType is null && !syntax.Modifiers.Any(SyntaxKind.PartialKeyword) && syntax.Arity == 0 102firstParam.Modifiers.Any(SyntaxKind.ThisKeyword) && 250CheckExtensionAttributeAvailability(DeclaringCompilation, syntax.ParameterList.Parameters[0].Modifiers.FirstOrDefault(SyntaxKind.ThisKeyword).GetLocation(), diagnostics); 717if (this.ReturnType?.IsErrorType() == true && GetSyntax().ReturnType is IdentifierNameSyntax { Identifier.RawContextualKind: (int)SyntaxKind.PartialKeyword }) 886diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.SealedKeyword)); 908diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword)); 913diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.VirtualKeyword)); 1164if (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), 563var syntax = modifiers.FirstOrDefault(SyntaxKind.UnsafeKeyword); 716case SyntaxKind.GetAccessorDeclaration: 717case SyntaxKind.SetAccessorDeclaration: 718case SyntaxKind.InitAccessorDeclaration: 789case SyntaxKind.GetAccessorDeclaration: 790case SyntaxKind.SetAccessorDeclaration: 791case SyntaxKind.InitAccessorDeclaration: 792case 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 (6)
348{ MethodKind: MethodKind.PropertyGet, IsInitOnly: false } => SyntaxFacts.GetText(SyntaxKind.GetKeyword), 349{ MethodKind: MethodKind.PropertySet, IsInitOnly: false } => SyntaxFacts.GetText(SyntaxKind.SetKeyword), 350{ MethodKind: MethodKind.PropertySet, IsInitOnly: true } => SyntaxFacts.GetText(SyntaxKind.InitKeyword), 506if (node.ArgumentList?.Arguments is not [{ NameColon: null, NameEquals: null, Expression: LiteralExpressionSyntax { RawKind: (int)SyntaxKind.StringLiteralExpression } }]) 1129diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.AbstractKeyword)); 1134diagnostics.Add(ErrorCode.ERR_BadMemberFlag, location, SyntaxFacts.GetText(SyntaxKind.VirtualKeyword));
Symbols\Source\SourceUserDefinedConversionSymbol.cs (1)
33else if (syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword))
Symbols\Source\SourceUserDefinedOperatorSymbol.cs (1)
34else if (!syntax.OperatorToken.IsMissing && syntax.CheckedKeyword.IsKind(SyntaxKind.CheckedKeyword))
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (7)
65!(syntax is OperatorDeclarationSyntax { OperatorToken: var opToken } && opToken.Kind() is not (SyntaxKind.EqualsEqualsToken or SyntaxKind.ExclamationEqualsToken))) 197if (syntax is OperatorDeclarationSyntax { OperatorToken: var opToken } && opToken.Kind() is not (SyntaxKind.EqualsEqualsToken or SyntaxKind.ExclamationEqualsToken)) 270if (syntax is OperatorDeclarationSyntax { OperatorToken: var opToken } && opToken.Kind() is not (SyntaxKind.EqualsEqualsToken or SyntaxKind.ExclamationEqualsToken)) 332if (arglistToken.Kind() == SyntaxKind.ArgListKeyword)
Symbols\Source\TypeParameterBuilder.cs (1)
29Debug.Assert(syntaxRef.GetSyntax().IsKind(SyntaxKind.TypeParameter));
Symbols\Symbol.cs (1)
512if (token.Kind() != SyntaxKind.None)
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (4)
26Debug.Assert(syntax.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration);
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (2)
296public SyntaxNode ReturnTypeSyntax => CompilationUnit.Members.First(m => m.Kind() == SyntaxKind.GlobalStatement); 302if (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 (143)
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); 2991keyword.Kind() is SyntaxKind.UnionKeyword ? SyntaxKind.UnionDeclaration : SyntaxKind.StructDeclaration,
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 (1023)
13public static bool IsKeywordKind(SyntaxKind kind) 18public static IEnumerable<SyntaxKind> GetReservedKeywordKinds() 20for (int i = (int)SyntaxKind.BoolKeyword; i <= (int)SyntaxKind.ImplicitKeyword; i++) 22Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 23yield return (SyntaxKind)i; 27public static IEnumerable<SyntaxKind> GetKeywordKinds() 29foreach (var reserved in GetReservedKeywordKinds()) 34foreach (var contextual in GetContextualKeywordKinds()) 40public static bool IsReservedKeyword(SyntaxKind kind) 42return kind >= SyntaxKind.BoolKeyword && kind <= SyntaxKind.ImplicitKeyword; 45public static bool IsAttributeTargetSpecifier(SyntaxKind kind) 49case SyntaxKind.AssemblyKeyword: 50case SyntaxKind.ModuleKeyword: 51case SyntaxKind.EventKeyword: 52case SyntaxKind.FieldKeyword: 53case SyntaxKind.MethodKeyword: 54case SyntaxKind.ParamKeyword: 55case SyntaxKind.PropertyKeyword: 56case SyntaxKind.ReturnKeyword: 57case SyntaxKind.TypeKeyword: 58case SyntaxKind.TypeVarKeyword: 65public static bool IsAccessibilityModifier(SyntaxKind kind) 69case SyntaxKind.PrivateKeyword: 70case SyntaxKind.ProtectedKeyword: 71case SyntaxKind.InternalKeyword: 72case SyntaxKind.PublicKeyword: 79public static bool IsPreprocessorKeyword(SyntaxKind kind) 83case SyntaxKind.TrueKeyword: 84case SyntaxKind.FalseKeyword: 85case SyntaxKind.DefaultKeyword: 86case SyntaxKind.IfKeyword: 87case SyntaxKind.ElseKeyword: 88case SyntaxKind.ElifKeyword: 89case SyntaxKind.EndIfKeyword: 90case SyntaxKind.RegionKeyword: 91case SyntaxKind.EndRegionKeyword: 92case SyntaxKind.DefineKeyword: 93case SyntaxKind.UndefKeyword: 94case SyntaxKind.WarningKeyword: 95case SyntaxKind.ErrorKeyword: 96case SyntaxKind.LineKeyword: 97case SyntaxKind.PragmaKeyword: 98case SyntaxKind.HiddenKeyword: 99case SyntaxKind.ChecksumKeyword: 100case SyntaxKind.DisableKeyword: 101case SyntaxKind.RestoreKeyword: 102case SyntaxKind.ReferenceKeyword: 103case SyntaxKind.LoadKeyword: 104case SyntaxKind.NullableKeyword: 105case SyntaxKind.EnableKeyword: 106case SyntaxKind.WarningsKeyword: 107case SyntaxKind.AnnotationsKeyword: 123internal static bool IsPreprocessorContextualKeyword(SyntaxKind kind) 127case SyntaxKind.TrueKeyword: 128case SyntaxKind.FalseKeyword: 129case SyntaxKind.DefaultKeyword: 130case SyntaxKind.HiddenKeyword: 131case SyntaxKind.ChecksumKeyword: 132case SyntaxKind.DisableKeyword: 133case SyntaxKind.RestoreKeyword: 134case SyntaxKind.EnableKeyword: 135case SyntaxKind.WarningsKeyword: 136case SyntaxKind.AnnotationsKeyword: 143public static IEnumerable<SyntaxKind> GetPreprocessorKeywordKinds() 145yield return SyntaxKind.TrueKeyword; 146yield return SyntaxKind.FalseKeyword; 147yield return SyntaxKind.DefaultKeyword; 149for (int i = (int)SyntaxKind.ElifKeyword; i <= (int)SyntaxKind.RestoreKeyword; i++) 151Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 152yield return (SyntaxKind)i; 156public static bool IsPunctuation(SyntaxKind kind) 158return kind >= SyntaxKind.TildeToken && kind <= SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; 161public static bool IsLanguagePunctuation(SyntaxKind kind) 166public static bool IsPreprocessorPunctuation(SyntaxKind kind) 168return kind == SyntaxKind.HashToken; 171private static bool IsDebuggerSpecialPunctuation(SyntaxKind kind) 174return kind == SyntaxKind.DollarToken; 177public static IEnumerable<SyntaxKind> GetPunctuationKinds() 179for (int i = (int)SyntaxKind.TildeToken; i <= (int)SyntaxKind.DotDotToken; i++) 181Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 182yield return (SyntaxKind)i; 185for (int i = (int)SyntaxKind.SlashGreaterThanToken; i <= (int)SyntaxKind.XmlProcessingInstructionEndToken; i++) 187Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 188yield return (SyntaxKind)i; 191for (int i = (int)SyntaxKind.BarBarToken; i <= (int)SyntaxKind.QuestionQuestionEqualsToken; i++) 193Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 194yield return (SyntaxKind)i; 197yield return SyntaxKind.GreaterThanGreaterThanGreaterThanToken; 198yield return SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; 201public static bool IsPunctuationOrKeyword(SyntaxKind kind) 203return kind >= SyntaxKind.TildeToken && kind <= SyntaxKind.EndOfFileToken; 206internal static bool IsLiteral(SyntaxKind kind) 210case SyntaxKind.IdentifierToken: 211case SyntaxKind.StringLiteralToken: 212case SyntaxKind.Utf8StringLiteralToken: 213case SyntaxKind.SingleLineRawStringLiteralToken: 214case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 215case SyntaxKind.MultiLineRawStringLiteralToken: 216case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 217case SyntaxKind.CharacterLiteralToken: 218case SyntaxKind.NumericLiteralToken: 219case SyntaxKind.XmlTextLiteralToken: 220case SyntaxKind.XmlTextLiteralNewLineToken: 221case SyntaxKind.XmlEntityLiteralToken: 228public static bool IsAnyToken(SyntaxKind kind) 230if (kind >= SyntaxKind.TildeToken && kind < SyntaxKind.EndOfLineTrivia) return true; 233case SyntaxKind.InterpolatedStringToken: 234case SyntaxKind.InterpolatedStringStartToken: 235case SyntaxKind.InterpolatedVerbatimStringStartToken: 236case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 237case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 238case SyntaxKind.InterpolatedStringTextToken: 239case SyntaxKind.InterpolatedStringEndToken: 240case SyntaxKind.InterpolatedRawStringEndToken: 241case SyntaxKind.LoadKeyword: 242case SyntaxKind.NullableKeyword: 243case SyntaxKind.EnableKeyword: 244case SyntaxKind.UnderscoreToken: 245case SyntaxKind.MultiLineRawStringLiteralToken: 246case SyntaxKind.SingleLineRawStringLiteralToken: 253public static bool IsTrivia(SyntaxKind kind) 257case SyntaxKind.EndOfLineTrivia: 258case SyntaxKind.WhitespaceTrivia: 259case SyntaxKind.SingleLineCommentTrivia: 260case SyntaxKind.MultiLineCommentTrivia: 261case SyntaxKind.SingleLineDocumentationCommentTrivia: 262case SyntaxKind.MultiLineDocumentationCommentTrivia: 263case SyntaxKind.DisabledTextTrivia: 264case SyntaxKind.DocumentationCommentExteriorTrivia: 265case SyntaxKind.ConflictMarkerTrivia: 272public static bool IsPreprocessorDirective(SyntaxKind kind) 276case SyntaxKind.IfDirectiveTrivia: 277case SyntaxKind.ElifDirectiveTrivia: 278case SyntaxKind.ElseDirectiveTrivia: 279case SyntaxKind.EndIfDirectiveTrivia: 280case SyntaxKind.RegionDirectiveTrivia: 281case SyntaxKind.EndRegionDirectiveTrivia: 282case SyntaxKind.DefineDirectiveTrivia: 283case SyntaxKind.UndefDirectiveTrivia: 284case SyntaxKind.ErrorDirectiveTrivia: 285case SyntaxKind.WarningDirectiveTrivia: 286case SyntaxKind.LineDirectiveTrivia: 287case SyntaxKind.LineSpanDirectiveTrivia: 288case SyntaxKind.PragmaWarningDirectiveTrivia: 289case SyntaxKind.PragmaChecksumDirectiveTrivia: 290case SyntaxKind.ReferenceDirectiveTrivia: 291case SyntaxKind.LoadDirectiveTrivia: 292case SyntaxKind.BadDirectiveTrivia: 293case SyntaxKind.ShebangDirectiveTrivia: 294case SyntaxKind.IgnoredDirectiveTrivia: 295case SyntaxKind.NullableDirectiveTrivia: 302public static bool IsName(SyntaxKind kind) 306case SyntaxKind.IdentifierName: 307case SyntaxKind.GenericName: 308case SyntaxKind.QualifiedName: 309case SyntaxKind.AliasQualifiedName: 316public static bool IsPredefinedType(SyntaxKind kind) 320case SyntaxKind.BoolKeyword: 321case SyntaxKind.ByteKeyword: 322case SyntaxKind.SByteKeyword: 323case SyntaxKind.IntKeyword: 324case SyntaxKind.UIntKeyword: 325case SyntaxKind.ShortKeyword: 326case SyntaxKind.UShortKeyword: 327case SyntaxKind.LongKeyword: 328case SyntaxKind.ULongKeyword: 329case SyntaxKind.FloatKeyword: 330case SyntaxKind.DoubleKeyword: 331case SyntaxKind.DecimalKeyword: 332case SyntaxKind.StringKeyword: 333case SyntaxKind.CharKeyword: 334case SyntaxKind.ObjectKeyword: 335case SyntaxKind.VoidKeyword: 342public static bool IsTypeSyntax(SyntaxKind kind) 346case SyntaxKind.ArrayType: 347case SyntaxKind.PointerType: 348case SyntaxKind.NullableType: 349case SyntaxKind.PredefinedType: 350case SyntaxKind.TupleType: 351case SyntaxKind.FunctionPointerType: 361public static bool IsGlobalMemberDeclaration(SyntaxKind kind) 365case SyntaxKind.GlobalStatement: 366case SyntaxKind.FieldDeclaration: 367case SyntaxKind.MethodDeclaration: 368case SyntaxKind.PropertyDeclaration: 369case SyntaxKind.EventDeclaration: 370case SyntaxKind.EventFieldDeclaration: 376public static bool IsTypeDeclaration(SyntaxKind kind) 380case SyntaxKind.ClassDeclaration: 381case SyntaxKind.StructDeclaration: 382case SyntaxKind.UnionDeclaration: 383case SyntaxKind.InterfaceDeclaration: 384case SyntaxKind.DelegateDeclaration: 385case SyntaxKind.EnumDeclaration: 386case SyntaxKind.RecordDeclaration: 387case SyntaxKind.RecordStructDeclaration: 388case SyntaxKind.ExtensionBlockDeclaration: 396public static bool IsNamespaceMemberDeclaration(SyntaxKind kind) 398kind == SyntaxKind.NamespaceDeclaration || 399kind == SyntaxKind.FileScopedNamespaceDeclaration; 401public static bool IsAnyUnaryExpression(SyntaxKind token) 406public static bool IsPrefixUnaryExpression(SyntaxKind token) 408return GetPrefixUnaryExpression(token) != SyntaxKind.None; 411public static bool IsPrefixUnaryExpressionOperatorToken(SyntaxKind token) 413return GetPrefixUnaryExpression(token) != SyntaxKind.None; 416public static SyntaxKind GetPrefixUnaryExpression(SyntaxKind token) 420case SyntaxKind.PlusToken: 421return SyntaxKind.UnaryPlusExpression; 422case SyntaxKind.MinusToken: 423return SyntaxKind.UnaryMinusExpression; 424case SyntaxKind.TildeToken: 425return SyntaxKind.BitwiseNotExpression; 426case SyntaxKind.ExclamationToken: 427return SyntaxKind.LogicalNotExpression; 428case SyntaxKind.PlusPlusToken: 429return SyntaxKind.PreIncrementExpression; 430case SyntaxKind.MinusMinusToken: 431return SyntaxKind.PreDecrementExpression; 432case SyntaxKind.AmpersandToken: 433return SyntaxKind.AddressOfExpression; 434case SyntaxKind.AsteriskToken: 435return SyntaxKind.PointerIndirectionExpression; 436case SyntaxKind.CaretToken: 437return SyntaxKind.IndexExpression; 439return SyntaxKind.None; 443public static bool IsPostfixUnaryExpression(SyntaxKind token) 445return GetPostfixUnaryExpression(token) != SyntaxKind.None; 448public static bool IsPostfixUnaryExpressionToken(SyntaxKind token) 450return GetPostfixUnaryExpression(token) != SyntaxKind.None; 453public static SyntaxKind GetPostfixUnaryExpression(SyntaxKind token) 457case SyntaxKind.PlusPlusToken: 458return SyntaxKind.PostIncrementExpression; 459case SyntaxKind.MinusMinusToken: 460return SyntaxKind.PostDecrementExpression; 461case SyntaxKind.ExclamationToken: 462return SyntaxKind.SuppressNullableWarningExpression; 464return SyntaxKind.None; 468internal static bool IsIncrementOrDecrementOperator(SyntaxKind token) 472case SyntaxKind.PlusPlusToken: 473case SyntaxKind.MinusMinusToken: 480public static bool IsUnaryOperatorDeclarationToken(SyntaxKind token) 483token == SyntaxKind.TrueKeyword || 484token == SyntaxKind.FalseKeyword; 487public static bool IsAnyOverloadableOperator(SyntaxKind kind) 494public static bool IsOverloadableBinaryOperator(SyntaxKind kind) 498case SyntaxKind.PlusToken: 499case SyntaxKind.MinusToken: 500case SyntaxKind.AsteriskToken: 501case SyntaxKind.SlashToken: 502case SyntaxKind.PercentToken: 503case SyntaxKind.CaretToken: 504case SyntaxKind.AmpersandToken: 505case SyntaxKind.BarToken: 506case SyntaxKind.EqualsEqualsToken: 507case SyntaxKind.LessThanToken: 508case SyntaxKind.LessThanEqualsToken: 509case SyntaxKind.LessThanLessThanToken: 510case SyntaxKind.GreaterThanToken: 511case SyntaxKind.GreaterThanEqualsToken: 512case SyntaxKind.GreaterThanGreaterThanToken: 513case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 514case SyntaxKind.ExclamationEqualsToken: 521public static bool IsOverloadableUnaryOperator(SyntaxKind kind) 525case SyntaxKind.PlusToken: 526case SyntaxKind.MinusToken: 527case SyntaxKind.TildeToken: 528case SyntaxKind.ExclamationToken: 529case SyntaxKind.PlusPlusToken: 530case SyntaxKind.MinusMinusToken: 531case SyntaxKind.TrueKeyword: 532case SyntaxKind.FalseKeyword: 539public static bool IsOverloadableCompoundAssignmentOperator(SyntaxKind kind) 543case SyntaxKind.PlusEqualsToken: 544case SyntaxKind.MinusEqualsToken: 545case SyntaxKind.AsteriskEqualsToken: 546case SyntaxKind.SlashEqualsToken: 547case SyntaxKind.PercentEqualsToken: 548case SyntaxKind.AmpersandEqualsToken: 549case SyntaxKind.BarEqualsToken: 550case SyntaxKind.CaretEqualsToken: 551case SyntaxKind.LessThanLessThanEqualsToken: 552case SyntaxKind.GreaterThanGreaterThanEqualsToken: 553case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 560public static bool IsPrimaryFunction(SyntaxKind keyword) 562return GetPrimaryFunction(keyword) != SyntaxKind.None; 565public static SyntaxKind GetPrimaryFunction(SyntaxKind keyword) 569case SyntaxKind.MakeRefKeyword: 570return SyntaxKind.MakeRefExpression; 571case SyntaxKind.RefTypeKeyword: 572return SyntaxKind.RefTypeExpression; 573case SyntaxKind.RefValueKeyword: 574return SyntaxKind.RefValueExpression; 575case SyntaxKind.CheckedKeyword: 576return SyntaxKind.CheckedExpression; 577case SyntaxKind.UncheckedKeyword: 578return SyntaxKind.UncheckedExpression; 579case SyntaxKind.DefaultKeyword: 580return SyntaxKind.DefaultExpression; 581case SyntaxKind.TypeOfKeyword: 582return SyntaxKind.TypeOfExpression; 583case SyntaxKind.SizeOfKeyword: 584return SyntaxKind.SizeOfExpression; 586return SyntaxKind.None; 590public static bool IsLiteralExpression(SyntaxKind token) 592return GetLiteralExpression(token) != SyntaxKind.None; 595public static SyntaxKind GetLiteralExpression(SyntaxKind token) 599SyntaxKind.StringLiteralToken => SyntaxKind.StringLiteralExpression, 600SyntaxKind.Utf8StringLiteralToken => SyntaxKind.Utf8StringLiteralExpression, 601SyntaxKind.SingleLineRawStringLiteralToken => SyntaxKind.StringLiteralExpression, 602SyntaxKind.Utf8SingleLineRawStringLiteralToken => SyntaxKind.Utf8StringLiteralExpression, 603SyntaxKind.MultiLineRawStringLiteralToken => SyntaxKind.StringLiteralExpression, 604SyntaxKind.Utf8MultiLineRawStringLiteralToken => SyntaxKind.Utf8StringLiteralExpression, 605SyntaxKind.CharacterLiteralToken => SyntaxKind.CharacterLiteralExpression, 606SyntaxKind.NumericLiteralToken => SyntaxKind.NumericLiteralExpression, 607SyntaxKind.NullKeyword => SyntaxKind.NullLiteralExpression, 608SyntaxKind.TrueKeyword => SyntaxKind.TrueLiteralExpression, 609SyntaxKind.FalseKeyword => SyntaxKind.FalseLiteralExpression, 610SyntaxKind.ArgListKeyword => SyntaxKind.ArgListExpression, 611_ => SyntaxKind.None, 615public static bool IsInstanceExpression(SyntaxKind token) 617return GetInstanceExpression(token) != SyntaxKind.None; 620public static SyntaxKind GetInstanceExpression(SyntaxKind token) 624case SyntaxKind.ThisKeyword: 625return SyntaxKind.ThisExpression; 626case SyntaxKind.BaseKeyword: 627return SyntaxKind.BaseExpression; 629return SyntaxKind.None; 633public static bool IsBinaryExpression(SyntaxKind token) 635return GetBinaryExpression(token) != SyntaxKind.None; 638public static bool IsBinaryExpressionOperatorToken(SyntaxKind token) 640return GetBinaryExpression(token) != SyntaxKind.None; 643public static SyntaxKind GetBinaryExpression(SyntaxKind token) 647case SyntaxKind.QuestionQuestionToken: 648return SyntaxKind.CoalesceExpression; 649case SyntaxKind.IsKeyword: 650return SyntaxKind.IsExpression; 651case SyntaxKind.AsKeyword: 652return SyntaxKind.AsExpression; 653case SyntaxKind.BarToken: 654return SyntaxKind.BitwiseOrExpression; 655case SyntaxKind.CaretToken: 656return SyntaxKind.ExclusiveOrExpression; 657case SyntaxKind.AmpersandToken: 658return SyntaxKind.BitwiseAndExpression; 659case SyntaxKind.EqualsEqualsToken: 660return SyntaxKind.EqualsExpression; 661case SyntaxKind.ExclamationEqualsToken: 662return SyntaxKind.NotEqualsExpression; 663case SyntaxKind.LessThanToken: 664return SyntaxKind.LessThanExpression; 665case SyntaxKind.LessThanEqualsToken: 666return SyntaxKind.LessThanOrEqualExpression; 667case SyntaxKind.GreaterThanToken: 668return SyntaxKind.GreaterThanExpression; 669case SyntaxKind.GreaterThanEqualsToken: 670return SyntaxKind.GreaterThanOrEqualExpression; 671case SyntaxKind.LessThanLessThanToken: 672return SyntaxKind.LeftShiftExpression; 673case SyntaxKind.GreaterThanGreaterThanToken: 674return SyntaxKind.RightShiftExpression; 675case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 676return SyntaxKind.UnsignedRightShiftExpression; 677case SyntaxKind.PlusToken: 678return SyntaxKind.AddExpression; 679case SyntaxKind.MinusToken: 680return SyntaxKind.SubtractExpression; 681case SyntaxKind.AsteriskToken: 682return SyntaxKind.MultiplyExpression; 683case SyntaxKind.SlashToken: 684return SyntaxKind.DivideExpression; 685case SyntaxKind.PercentToken: 686return SyntaxKind.ModuloExpression; 687case SyntaxKind.AmpersandAmpersandToken: 688return SyntaxKind.LogicalAndExpression; 689case SyntaxKind.BarBarToken: 690return SyntaxKind.LogicalOrExpression; 692return SyntaxKind.None; 696public static bool IsAssignmentExpression(SyntaxKind kind) 700case SyntaxKind.CoalesceAssignmentExpression: 701case SyntaxKind.OrAssignmentExpression: 702case SyntaxKind.AndAssignmentExpression: 703case SyntaxKind.ExclusiveOrAssignmentExpression: 704case SyntaxKind.LeftShiftAssignmentExpression: 705case SyntaxKind.RightShiftAssignmentExpression: 706case SyntaxKind.UnsignedRightShiftAssignmentExpression: 707case SyntaxKind.AddAssignmentExpression: 708case SyntaxKind.SubtractAssignmentExpression: 709case SyntaxKind.MultiplyAssignmentExpression: 710case SyntaxKind.DivideAssignmentExpression: 711case SyntaxKind.ModuloAssignmentExpression: 712case SyntaxKind.SimpleAssignmentExpression: 719public static bool IsAssignmentExpressionOperatorToken(SyntaxKind token) 723case SyntaxKind.QuestionQuestionEqualsToken: 724case SyntaxKind.BarEqualsToken: 725case SyntaxKind.AmpersandEqualsToken: 726case SyntaxKind.CaretEqualsToken: 727case SyntaxKind.LessThanLessThanEqualsToken: 728case SyntaxKind.GreaterThanGreaterThanEqualsToken: 729case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 730case SyntaxKind.PlusEqualsToken: 731case SyntaxKind.MinusEqualsToken: 732case SyntaxKind.AsteriskEqualsToken: 733case SyntaxKind.SlashEqualsToken: 734case SyntaxKind.PercentEqualsToken: 735case SyntaxKind.EqualsToken: 742public static SyntaxKind GetAssignmentExpression(SyntaxKind token) 746case SyntaxKind.BarEqualsToken: 747return SyntaxKind.OrAssignmentExpression; 748case SyntaxKind.AmpersandEqualsToken: 749return SyntaxKind.AndAssignmentExpression; 750case SyntaxKind.CaretEqualsToken: 751return SyntaxKind.ExclusiveOrAssignmentExpression; 752case SyntaxKind.LessThanLessThanEqualsToken: 753return SyntaxKind.LeftShiftAssignmentExpression; 754case SyntaxKind.GreaterThanGreaterThanEqualsToken: 755return SyntaxKind.RightShiftAssignmentExpression; 756case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 757return SyntaxKind.UnsignedRightShiftAssignmentExpression; 758case SyntaxKind.PlusEqualsToken: 759return SyntaxKind.AddAssignmentExpression; 760case SyntaxKind.MinusEqualsToken: 761return SyntaxKind.SubtractAssignmentExpression; 762case SyntaxKind.AsteriskEqualsToken: 763return SyntaxKind.MultiplyAssignmentExpression; 764case SyntaxKind.SlashEqualsToken: 765return SyntaxKind.DivideAssignmentExpression; 766case SyntaxKind.PercentEqualsToken: 767return SyntaxKind.ModuloAssignmentExpression; 768case SyntaxKind.EqualsToken: 769return SyntaxKind.SimpleAssignmentExpression; 770case SyntaxKind.QuestionQuestionEqualsToken: 771return SyntaxKind.CoalesceAssignmentExpression; 773return SyntaxKind.None; 777public static SyntaxKind GetCheckStatement(SyntaxKind keyword) 781case SyntaxKind.CheckedKeyword: 782return SyntaxKind.CheckedStatement; 783case SyntaxKind.UncheckedKeyword: 784return SyntaxKind.UncheckedStatement; 786return SyntaxKind.None; 790public static SyntaxKind GetAccessorDeclarationKind(SyntaxKind keyword) 794case SyntaxKind.GetKeyword: 795return SyntaxKind.GetAccessorDeclaration; 796case SyntaxKind.SetKeyword: 797return SyntaxKind.SetAccessorDeclaration; 798case SyntaxKind.InitKeyword: 799return SyntaxKind.InitAccessorDeclaration; 800case SyntaxKind.AddKeyword: 801return SyntaxKind.AddAccessorDeclaration; 802case SyntaxKind.RemoveKeyword: 803return SyntaxKind.RemoveAccessorDeclaration; 805return SyntaxKind.None; 809public static bool IsAccessorDeclaration(SyntaxKind kind) 813case SyntaxKind.GetAccessorDeclaration: 814case SyntaxKind.SetAccessorDeclaration: 815case SyntaxKind.InitAccessorDeclaration: 816case SyntaxKind.AddAccessorDeclaration: 817case SyntaxKind.RemoveAccessorDeclaration: 824public static bool IsAccessorDeclarationKeyword(SyntaxKind keyword) 828case SyntaxKind.GetKeyword: 829case SyntaxKind.SetKeyword: 830case SyntaxKind.InitKeyword: 831case SyntaxKind.AddKeyword: 832case SyntaxKind.RemoveKeyword: 839public static SyntaxKind GetSwitchLabelKind(SyntaxKind keyword) 843case SyntaxKind.CaseKeyword: 844return SyntaxKind.CaseSwitchLabel; 845case SyntaxKind.DefaultKeyword: 846return SyntaxKind.DefaultSwitchLabel; 848return SyntaxKind.None; 852public static SyntaxKind GetBaseTypeDeclarationKind(SyntaxKind kind) 854return kind == SyntaxKind.EnumKeyword ? SyntaxKind.EnumDeclaration : GetTypeDeclarationKind(kind); 857public static SyntaxKind GetTypeDeclarationKind(SyntaxKind kind) 861case SyntaxKind.ClassKeyword: 862return SyntaxKind.ClassDeclaration; 863case SyntaxKind.StructKeyword: 864return SyntaxKind.StructDeclaration; 865case SyntaxKind.UnionKeyword: 866return SyntaxKind.UnionDeclaration; 867case SyntaxKind.InterfaceKeyword: 868return SyntaxKind.InterfaceDeclaration; 869case SyntaxKind.RecordKeyword: 870return SyntaxKind.RecordDeclaration; 871case SyntaxKind.ExtensionKeyword: 872return SyntaxKind.ExtensionBlockDeclaration; 874return SyntaxKind.None; 878public static SyntaxKind GetKeywordKind(string text) 883return SyntaxKind.BoolKeyword; 885return SyntaxKind.ByteKeyword; 887return SyntaxKind.SByteKeyword; 889return SyntaxKind.ShortKeyword; 891return SyntaxKind.UShortKeyword; 893return SyntaxKind.IntKeyword; 895return SyntaxKind.UIntKeyword; 897return SyntaxKind.LongKeyword; 899return SyntaxKind.ULongKeyword; 901return SyntaxKind.DoubleKeyword; 903return SyntaxKind.FloatKeyword; 905return SyntaxKind.DecimalKeyword; 907return SyntaxKind.StringKeyword; 909return SyntaxKind.CharKeyword; 911return SyntaxKind.VoidKeyword; 913return SyntaxKind.ObjectKeyword; 915return SyntaxKind.TypeOfKeyword; 917return SyntaxKind.SizeOfKeyword; 919return SyntaxKind.NullKeyword; 921return SyntaxKind.TrueKeyword; 923return SyntaxKind.FalseKeyword; 925return SyntaxKind.IfKeyword; 927return SyntaxKind.ElseKeyword; 929return SyntaxKind.WhileKeyword; 931return SyntaxKind.ForKeyword; 933return SyntaxKind.ForEachKeyword; 935return SyntaxKind.DoKeyword; 937return SyntaxKind.SwitchKeyword; 939return SyntaxKind.CaseKeyword; 941return SyntaxKind.DefaultKeyword; 943return SyntaxKind.LockKeyword; 945return SyntaxKind.TryKeyword; 947return SyntaxKind.ThrowKeyword; 949return SyntaxKind.CatchKeyword; 951return SyntaxKind.FinallyKeyword; 953return SyntaxKind.GotoKeyword; 955return SyntaxKind.BreakKeyword; 957return SyntaxKind.ContinueKeyword; 959return SyntaxKind.ReturnKeyword; 961return SyntaxKind.PublicKeyword; 963return SyntaxKind.PrivateKeyword; 965return SyntaxKind.InternalKeyword; 967return SyntaxKind.ProtectedKeyword; 969return SyntaxKind.StaticKeyword; 971return SyntaxKind.ReadOnlyKeyword; 973return SyntaxKind.SealedKeyword; 975return SyntaxKind.ConstKeyword; 977return SyntaxKind.FixedKeyword; 979return SyntaxKind.StackAllocKeyword; 981return SyntaxKind.VolatileKeyword; 983return SyntaxKind.NewKeyword; 985return SyntaxKind.OverrideKeyword; 987return SyntaxKind.AbstractKeyword; 989return SyntaxKind.VirtualKeyword; 991return SyntaxKind.EventKeyword; 993return SyntaxKind.ExternKeyword; 995return SyntaxKind.RefKeyword; 997return SyntaxKind.OutKeyword; 999return SyntaxKind.InKeyword; 1001return SyntaxKind.IsKeyword; 1003return SyntaxKind.AsKeyword; 1005return SyntaxKind.ParamsKeyword; 1007return SyntaxKind.ArgListKeyword; 1009return SyntaxKind.MakeRefKeyword; 1011return SyntaxKind.RefTypeKeyword; 1013return SyntaxKind.RefValueKeyword; 1015return SyntaxKind.ThisKeyword; 1017return SyntaxKind.BaseKeyword; 1019return SyntaxKind.NamespaceKeyword; 1021return SyntaxKind.UsingKeyword; 1023return SyntaxKind.ClassKeyword; 1025return SyntaxKind.StructKeyword; 1027return SyntaxKind.InterfaceKeyword; 1029return SyntaxKind.EnumKeyword; 1031return SyntaxKind.DelegateKeyword; 1033return SyntaxKind.CheckedKeyword; 1035return SyntaxKind.UncheckedKeyword; 1037return SyntaxKind.UnsafeKeyword; 1039return SyntaxKind.OperatorKeyword; 1041return SyntaxKind.ImplicitKeyword; 1043return SyntaxKind.ExplicitKeyword; 1045return SyntaxKind.None; 1049public static SyntaxKind GetOperatorKind(string operatorMetadataName) 1055return SyntaxKind.PlusToken; 1057case WellKnownMemberNames.BitwiseAndOperatorName: return SyntaxKind.AmpersandToken; 1058case WellKnownMemberNames.BitwiseOrOperatorName: return SyntaxKind.BarToken; 1065return SyntaxKind.MinusMinusToken; 1069return SyntaxKind.SlashToken; 1071case WellKnownMemberNames.EqualityOperatorName: return SyntaxKind.EqualsEqualsToken; 1072case WellKnownMemberNames.ExclusiveOrOperatorName: return SyntaxKind.CaretToken; 1076return SyntaxKind.ExplicitKeyword; 1079case WellKnownMemberNames.FalseOperatorName: return SyntaxKind.FalseKeyword; 1080case WellKnownMemberNames.GreaterThanOperatorName: return SyntaxKind.GreaterThanToken; 1081case WellKnownMemberNames.GreaterThanOrEqualOperatorName: return SyntaxKind.GreaterThanEqualsToken; 1082case WellKnownMemberNames.ImplicitConversionName: return SyntaxKind.ImplicitKeyword; 1088return SyntaxKind.PlusPlusToken; 1090case WellKnownMemberNames.InequalityOperatorName: return SyntaxKind.ExclamationEqualsToken; 1092case WellKnownMemberNames.LeftShiftOperatorName: return SyntaxKind.LessThanLessThanToken; 1093case WellKnownMemberNames.LessThanOperatorName: return SyntaxKind.LessThanToken; 1094case WellKnownMemberNames.LessThanOrEqualOperatorName: return SyntaxKind.LessThanEqualsToken; 1096case WellKnownMemberNames.LogicalNotOperatorName: return SyntaxKind.ExclamationToken; 1097case WellKnownMemberNames.ModulusOperatorName: return SyntaxKind.PercentToken; 1101return SyntaxKind.AsteriskToken; 1103case WellKnownMemberNames.OnesComplementOperatorName: return SyntaxKind.TildeToken; 1104case WellKnownMemberNames.RightShiftOperatorName: return SyntaxKind.GreaterThanGreaterThanToken; 1105case WellKnownMemberNames.UnsignedRightShiftOperatorName: return SyntaxKind.GreaterThanGreaterThanGreaterThanToken; 1109return SyntaxKind.MinusToken; 1111case WellKnownMemberNames.TrueOperatorName: return SyntaxKind.TrueKeyword; 1115return SyntaxKind.MinusToken; 1117case WellKnownMemberNames.UnaryPlusOperatorName: return SyntaxKind.PlusToken; 1121return SyntaxKind.PlusEqualsToken; 1125return SyntaxKind.SlashEqualsToken; 1129return SyntaxKind.AsteriskEqualsToken; 1133return SyntaxKind.MinusEqualsToken; 1135case WellKnownMemberNames.ModulusAssignmentOperatorName: return SyntaxKind.PercentEqualsToken; 1137case WellKnownMemberNames.BitwiseAndAssignmentOperatorName: return SyntaxKind.AmpersandEqualsToken; 1139case WellKnownMemberNames.BitwiseOrAssignmentOperatorName: return SyntaxKind.BarEqualsToken; 1141case WellKnownMemberNames.ExclusiveOrAssignmentOperatorName: return SyntaxKind.CaretEqualsToken; 1143case WellKnownMemberNames.LeftShiftAssignmentOperatorName: return SyntaxKind.LessThanLessThanEqualsToken; 1145case WellKnownMemberNames.RightShiftAssignmentOperatorName: return SyntaxKind.GreaterThanGreaterThanEqualsToken; 1147case WellKnownMemberNames.UnsignedRightShiftAssignmentOperatorName: return SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken; 1150return SyntaxKind.None; 1179public static SyntaxKind GetPreprocessorKeywordKind(string text) 1184return SyntaxKind.TrueKeyword; 1186return SyntaxKind.FalseKeyword; 1188return SyntaxKind.DefaultKeyword; 1190return SyntaxKind.IfKeyword; 1192return SyntaxKind.ElseKeyword; 1194return SyntaxKind.ElifKeyword; 1196return SyntaxKind.EndIfKeyword; 1198return SyntaxKind.RegionKeyword; 1200return SyntaxKind.EndRegionKeyword; 1202return SyntaxKind.DefineKeyword; 1204return SyntaxKind.UndefKeyword; 1206return SyntaxKind.WarningKeyword; 1208return SyntaxKind.ErrorKeyword; 1210return SyntaxKind.LineKeyword; 1212return SyntaxKind.PragmaKeyword; 1214return SyntaxKind.HiddenKeyword; 1216return SyntaxKind.ChecksumKeyword; 1218return SyntaxKind.DisableKeyword; 1220return SyntaxKind.RestoreKeyword; 1222return SyntaxKind.ReferenceKeyword; 1224return SyntaxKind.LoadKeyword; 1226return SyntaxKind.NullableKeyword; 1228return SyntaxKind.EnableKeyword; 1230return SyntaxKind.WarningsKeyword; 1232return SyntaxKind.AnnotationsKeyword; 1234return SyntaxKind.None; 1238public static IEnumerable<SyntaxKind> GetContextualKeywordKinds() 1240for (int i = (int)SyntaxKind.YieldKeyword; i <= (int)SyntaxKind.ClosedKeyword; i++) 1245Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 1246yield return (SyntaxKind)i; 1251public static bool IsContextualKeyword(SyntaxKind kind) 1255case SyntaxKind.YieldKeyword: 1256case SyntaxKind.PartialKeyword: 1257case SyntaxKind.FromKeyword: 1258case SyntaxKind.GroupKeyword: 1259case SyntaxKind.JoinKeyword: 1260case SyntaxKind.IntoKeyword: 1261case SyntaxKind.LetKeyword: 1262case SyntaxKind.ByKeyword: 1263case SyntaxKind.WhereKeyword: 1264case SyntaxKind.SelectKeyword: 1265case SyntaxKind.GetKeyword: 1266case SyntaxKind.SetKeyword: 1267case SyntaxKind.AddKeyword: 1268case SyntaxKind.RemoveKeyword: 1269case SyntaxKind.OrderByKeyword: 1270case SyntaxKind.AliasKeyword: 1271case SyntaxKind.OnKeyword: 1272case SyntaxKind.EqualsKeyword: 1273case SyntaxKind.AscendingKeyword: 1274case SyntaxKind.DescendingKeyword: 1275case SyntaxKind.AssemblyKeyword: 1276case SyntaxKind.ModuleKeyword: 1277case SyntaxKind.TypeKeyword: 1278case SyntaxKind.GlobalKeyword: 1279case SyntaxKind.FieldKeyword: 1280case SyntaxKind.MethodKeyword: 1281case SyntaxKind.ParamKeyword: 1282case SyntaxKind.PropertyKeyword: 1283case SyntaxKind.TypeVarKeyword: 1284case SyntaxKind.NameOfKeyword: 1285case SyntaxKind.AsyncKeyword: 1286case SyntaxKind.AwaitKeyword: 1287case SyntaxKind.WhenKeyword: 1288case SyntaxKind.UnderscoreToken: 1289case SyntaxKind.VarKeyword: 1290case SyntaxKind.OrKeyword: 1291case SyntaxKind.AndKeyword: 1292case SyntaxKind.NotKeyword: 1293case SyntaxKind.WithKeyword: 1294case SyntaxKind.InitKeyword: 1295case SyntaxKind.RecordKeyword: 1296case SyntaxKind.ManagedKeyword: 1297case SyntaxKind.UnmanagedKeyword: 1298case SyntaxKind.RequiredKeyword: 1299case SyntaxKind.ScopedKeyword: 1300case SyntaxKind.FileKeyword: 1301case SyntaxKind.AllowsKeyword: 1302case SyntaxKind.ExtensionKeyword: 1303case SyntaxKind.UnionKeyword: 1304case SyntaxKind.ClosedKeyword: 1311public static bool IsQueryContextualKeyword(SyntaxKind kind) 1315case SyntaxKind.FromKeyword: 1316case SyntaxKind.WhereKeyword: 1317case SyntaxKind.SelectKeyword: 1318case SyntaxKind.GroupKeyword: 1319case SyntaxKind.IntoKeyword: 1320case SyntaxKind.OrderByKeyword: 1321case SyntaxKind.JoinKeyword: 1322case SyntaxKind.LetKeyword: 1323case SyntaxKind.OnKeyword: 1324case SyntaxKind.EqualsKeyword: 1325case SyntaxKind.ByKeyword: 1326case SyntaxKind.AscendingKeyword: 1327case SyntaxKind.DescendingKeyword: 1334public static SyntaxKind GetContextualKeywordKind(string text) 1339return SyntaxKind.YieldKeyword; 1341return SyntaxKind.PartialKeyword; 1343return SyntaxKind.FromKeyword; 1345return SyntaxKind.GroupKeyword; 1347return SyntaxKind.JoinKeyword; 1349return SyntaxKind.IntoKeyword; 1351return SyntaxKind.LetKeyword; 1353return SyntaxKind.ByKeyword; 1355return SyntaxKind.WhereKeyword; 1357return SyntaxKind.SelectKeyword; 1359return SyntaxKind.GetKeyword; 1361return SyntaxKind.SetKeyword; 1363return SyntaxKind.AddKeyword; 1365return SyntaxKind.RemoveKeyword; 1367return SyntaxKind.OrderByKeyword; 1369return SyntaxKind.AliasKeyword; 1371return SyntaxKind.OnKeyword; 1373return SyntaxKind.EqualsKeyword; 1375return SyntaxKind.AscendingKeyword; 1377return SyntaxKind.DescendingKeyword; 1379return SyntaxKind.AssemblyKeyword; 1381return SyntaxKind.ModuleKeyword; 1383return SyntaxKind.TypeKeyword; 1385return SyntaxKind.FieldKeyword; 1387return SyntaxKind.MethodKeyword; 1389return SyntaxKind.ParamKeyword; 1391return SyntaxKind.PropertyKeyword; 1393return SyntaxKind.TypeVarKeyword; 1395return SyntaxKind.GlobalKeyword; 1397return SyntaxKind.AsyncKeyword; 1399return SyntaxKind.AwaitKeyword; 1401return SyntaxKind.WhenKeyword; 1403return SyntaxKind.NameOfKeyword; 1405return SyntaxKind.UnderscoreToken; 1407return SyntaxKind.VarKeyword; 1409return SyntaxKind.AndKeyword; 1411return SyntaxKind.OrKeyword; 1413return SyntaxKind.NotKeyword; 1415return SyntaxKind.WithKeyword; 1417return SyntaxKind.InitKeyword; 1419return SyntaxKind.RecordKeyword; 1421return SyntaxKind.ManagedKeyword; 1423return SyntaxKind.UnmanagedKeyword; 1425return SyntaxKind.RequiredKeyword; 1427return SyntaxKind.ScopedKeyword; 1429return SyntaxKind.FileKeyword; 1431return SyntaxKind.AllowsKeyword; 1433return SyntaxKind.ExtensionKeyword; 1435return SyntaxKind.UnionKeyword; 1437return SyntaxKind.ClosedKeyword; 1439return SyntaxKind.None; 1443public static string GetText(SyntaxKind kind) 1447case SyntaxKind.TildeToken: 1449case SyntaxKind.ExclamationToken: 1451case SyntaxKind.DollarToken: 1453case SyntaxKind.PercentToken: 1455case SyntaxKind.CaretToken: 1457case SyntaxKind.AmpersandToken: 1459case SyntaxKind.AsteriskToken: 1461case SyntaxKind.OpenParenToken: 1463case SyntaxKind.CloseParenToken: 1465case SyntaxKind.MinusToken: 1467case SyntaxKind.PlusToken: 1469case SyntaxKind.EqualsToken: 1471case SyntaxKind.OpenBraceToken: 1473case SyntaxKind.CloseBraceToken: 1475case SyntaxKind.OpenBracketToken: 1477case SyntaxKind.CloseBracketToken: 1479case SyntaxKind.BarToken: 1481case SyntaxKind.BackslashToken: 1483case SyntaxKind.ColonToken: 1485case SyntaxKind.SemicolonToken: 1487case SyntaxKind.DoubleQuoteToken: 1489case SyntaxKind.SingleQuoteToken: 1491case SyntaxKind.LessThanToken: 1493case SyntaxKind.CommaToken: 1495case SyntaxKind.GreaterThanToken: 1497case SyntaxKind.DotToken: 1499case SyntaxKind.QuestionToken: 1501case SyntaxKind.HashToken: 1503case SyntaxKind.SlashToken: 1505case SyntaxKind.SlashGreaterThanToken: 1507case SyntaxKind.LessThanSlashToken: 1509case SyntaxKind.XmlCommentStartToken: 1511case SyntaxKind.XmlCommentEndToken: 1513case SyntaxKind.XmlCDataStartToken: 1515case SyntaxKind.XmlCDataEndToken: 1517case SyntaxKind.XmlProcessingInstructionStartToken: 1519case SyntaxKind.XmlProcessingInstructionEndToken: 1523case SyntaxKind.BarBarToken: 1525case SyntaxKind.AmpersandAmpersandToken: 1527case SyntaxKind.MinusMinusToken: 1529case SyntaxKind.PlusPlusToken: 1531case SyntaxKind.ColonColonToken: 1533case SyntaxKind.QuestionQuestionToken: 1535case SyntaxKind.MinusGreaterThanToken: 1537case SyntaxKind.ExclamationEqualsToken: 1539case SyntaxKind.EqualsEqualsToken: 1541case SyntaxKind.EqualsGreaterThanToken: 1543case SyntaxKind.LessThanEqualsToken: 1545case SyntaxKind.LessThanLessThanToken: 1547case SyntaxKind.LessThanLessThanEqualsToken: 1549case SyntaxKind.GreaterThanEqualsToken: 1551case SyntaxKind.GreaterThanGreaterThanToken: 1553case SyntaxKind.GreaterThanGreaterThanEqualsToken: 1555case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 1557case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 1559case SyntaxKind.SlashEqualsToken: 1561case SyntaxKind.AsteriskEqualsToken: 1563case SyntaxKind.BarEqualsToken: 1565case SyntaxKind.AmpersandEqualsToken: 1567case SyntaxKind.PlusEqualsToken: 1569case SyntaxKind.MinusEqualsToken: 1571case SyntaxKind.CaretEqualsToken: 1573case SyntaxKind.PercentEqualsToken: 1575case SyntaxKind.QuestionQuestionEqualsToken: 1577case SyntaxKind.DotDotToken: 1581case SyntaxKind.BoolKeyword: 1583case SyntaxKind.ByteKeyword: 1585case SyntaxKind.SByteKeyword: 1587case SyntaxKind.ShortKeyword: 1589case SyntaxKind.UShortKeyword: 1591case SyntaxKind.IntKeyword: 1593case SyntaxKind.UIntKeyword: 1595case SyntaxKind.LongKeyword: 1597case SyntaxKind.ULongKeyword: 1599case SyntaxKind.DoubleKeyword: 1601case SyntaxKind.FloatKeyword: 1603case SyntaxKind.DecimalKeyword: 1605case SyntaxKind.StringKeyword: 1607case SyntaxKind.CharKeyword: 1609case SyntaxKind.VoidKeyword: 1611case SyntaxKind.ObjectKeyword: 1613case SyntaxKind.TypeOfKeyword: 1615case SyntaxKind.SizeOfKeyword: 1617case SyntaxKind.NullKeyword: 1619case SyntaxKind.TrueKeyword: 1621case SyntaxKind.FalseKeyword: 1623case SyntaxKind.IfKeyword: 1625case SyntaxKind.ElseKeyword: 1627case SyntaxKind.WhileKeyword: 1629case SyntaxKind.ForKeyword: 1631case SyntaxKind.ForEachKeyword: 1633case SyntaxKind.DoKeyword: 1635case SyntaxKind.SwitchKeyword: 1637case SyntaxKind.CaseKeyword: 1639case SyntaxKind.DefaultKeyword: 1641case SyntaxKind.TryKeyword: 1643case SyntaxKind.CatchKeyword: 1645case SyntaxKind.FinallyKeyword: 1647case SyntaxKind.LockKeyword: 1649case SyntaxKind.GotoKeyword: 1651case SyntaxKind.BreakKeyword: 1653case SyntaxKind.ContinueKeyword: 1655case SyntaxKind.ReturnKeyword: 1657case SyntaxKind.ThrowKeyword: 1659case SyntaxKind.PublicKeyword: 1661case SyntaxKind.PrivateKeyword: 1663case SyntaxKind.InternalKeyword: 1665case SyntaxKind.ProtectedKeyword: 1667case SyntaxKind.StaticKeyword: 1669case SyntaxKind.ReadOnlyKeyword: 1671case SyntaxKind.SealedKeyword: 1673case SyntaxKind.ConstKeyword: 1675case SyntaxKind.FixedKeyword: 1677case SyntaxKind.StackAllocKeyword: 1679case SyntaxKind.VolatileKeyword: 1681case SyntaxKind.NewKeyword: 1683case SyntaxKind.OverrideKeyword: 1685case SyntaxKind.AbstractKeyword: 1687case SyntaxKind.VirtualKeyword: 1689case SyntaxKind.EventKeyword: 1691case SyntaxKind.ExternKeyword: 1693case SyntaxKind.RefKeyword: 1695case SyntaxKind.OutKeyword: 1697case SyntaxKind.InKeyword: 1699case SyntaxKind.IsKeyword: 1701case SyntaxKind.AsKeyword: 1703case SyntaxKind.ParamsKeyword: 1705case SyntaxKind.ArgListKeyword: 1707case SyntaxKind.MakeRefKeyword: 1709case SyntaxKind.RefTypeKeyword: 1711case SyntaxKind.RefValueKeyword: 1713case SyntaxKind.ThisKeyword: 1715case SyntaxKind.BaseKeyword: 1717case SyntaxKind.NamespaceKeyword: 1719case SyntaxKind.UsingKeyword: 1721case SyntaxKind.ClassKeyword: 1723case SyntaxKind.StructKeyword: 1725case SyntaxKind.InterfaceKeyword: 1727case SyntaxKind.EnumKeyword: 1729case SyntaxKind.DelegateKeyword: 1731case SyntaxKind.CheckedKeyword: 1733case SyntaxKind.UncheckedKeyword: 1735case SyntaxKind.UnsafeKeyword: 1737case SyntaxKind.OperatorKeyword: 1739case SyntaxKind.ImplicitKeyword: 1741case SyntaxKind.ExplicitKeyword: 1743case SyntaxKind.ElifKeyword: 1745case SyntaxKind.EndIfKeyword: 1747case SyntaxKind.RegionKeyword: 1749case SyntaxKind.EndRegionKeyword: 1751case SyntaxKind.DefineKeyword: 1753case SyntaxKind.UndefKeyword: 1755case SyntaxKind.WarningKeyword: 1757case SyntaxKind.ErrorKeyword: 1759case SyntaxKind.LineKeyword: 1761case SyntaxKind.PragmaKeyword: 1763case SyntaxKind.HiddenKeyword: 1765case SyntaxKind.ChecksumKeyword: 1767case SyntaxKind.DisableKeyword: 1769case SyntaxKind.RestoreKeyword: 1771case SyntaxKind.ReferenceKeyword: 1773case SyntaxKind.LoadKeyword: 1775case SyntaxKind.NullableKeyword: 1777case SyntaxKind.EnableKeyword: 1779case SyntaxKind.WarningsKeyword: 1781case SyntaxKind.AnnotationsKeyword: 1785case SyntaxKind.YieldKeyword: 1787case SyntaxKind.PartialKeyword: 1789case SyntaxKind.FromKeyword: 1791case SyntaxKind.GroupKeyword: 1793case SyntaxKind.JoinKeyword: 1795case SyntaxKind.IntoKeyword: 1797case SyntaxKind.LetKeyword: 1799case SyntaxKind.ByKeyword: 1801case SyntaxKind.WhereKeyword: 1803case SyntaxKind.SelectKeyword: 1805case SyntaxKind.GetKeyword: 1807case SyntaxKind.SetKeyword: 1809case SyntaxKind.AddKeyword: 1811case SyntaxKind.RemoveKeyword: 1813case SyntaxKind.OrderByKeyword: 1815case SyntaxKind.AliasKeyword: 1817case SyntaxKind.OnKeyword: 1819case SyntaxKind.EqualsKeyword: 1821case SyntaxKind.AscendingKeyword: 1823case SyntaxKind.DescendingKeyword: 1825case SyntaxKind.AssemblyKeyword: 1827case SyntaxKind.ModuleKeyword: 1829case SyntaxKind.TypeKeyword: 1831case SyntaxKind.FieldKeyword: 1833case SyntaxKind.MethodKeyword: 1835case SyntaxKind.ParamKeyword: 1837case SyntaxKind.PropertyKeyword: 1839case SyntaxKind.TypeVarKeyword: 1841case SyntaxKind.GlobalKeyword: 1843case SyntaxKind.NameOfKeyword: 1845case SyntaxKind.AsyncKeyword: 1847case SyntaxKind.AwaitKeyword: 1849case SyntaxKind.WhenKeyword: 1851case SyntaxKind.InterpolatedStringStartToken: 1853case SyntaxKind.InterpolatedStringEndToken: 1855case SyntaxKind.InterpolatedVerbatimStringStartToken: 1857case SyntaxKind.UnderscoreToken: 1859case SyntaxKind.VarKeyword: 1861case SyntaxKind.AndKeyword: 1863case SyntaxKind.OrKeyword: 1865case SyntaxKind.NotKeyword: 1867case SyntaxKind.WithKeyword: 1869case SyntaxKind.InitKeyword: 1871case SyntaxKind.RecordKeyword: 1873case SyntaxKind.ManagedKeyword: 1875case SyntaxKind.UnmanagedKeyword: 1877case SyntaxKind.RequiredKeyword: 1879case SyntaxKind.ScopedKeyword: 1881case SyntaxKind.FileKeyword: 1883case SyntaxKind.AllowsKeyword: 1885case SyntaxKind.ExtensionKeyword: 1887case SyntaxKind.UnionKeyword: 1889case SyntaxKind.ClosedKeyword: 1896public static bool IsTypeParameterVarianceKeyword(SyntaxKind kind) 1898return kind == SyntaxKind.OutKeyword || kind == SyntaxKind.InKeyword; 1901public static bool IsDocumentationCommentTrivia(SyntaxKind kind) 1903return kind == SyntaxKind.SingleLineDocumentationCommentTrivia || 1904kind == SyntaxKind.MultiLineDocumentationCommentTrivia;
Syntax\SyntaxNodeExtensions.cs (57)
23case SyntaxKind.ParenthesizedLambdaExpression: 24case SyntaxKind.SimpleLambdaExpression: 25case SyntaxKind.AnonymousMethodExpression: 37case SyntaxKind.FromClause: 38case SyntaxKind.GroupClause: 39case SyntaxKind.JoinClause: 40case SyntaxKind.JoinIntoClause: 41case SyntaxKind.LetClause: 42case SyntaxKind.OrderByClause: 43case SyntaxKind.QueryContinuation: 44case SyntaxKind.QueryExpression: 45case SyntaxKind.SelectClause: 46case SyntaxKind.WhereClause: 55if (node.Expression.Kind() == SyntaxKind.IdentifierName && 56((IdentifierNameSyntax)node.Expression).Identifier.ContextualKind() == SyntaxKind.NameOfKeyword && 80SyntaxKind kind = syntax.Kind(); 83case SyntaxKind.InvocationExpression when ((InvocationExpressionSyntax)syntax).MayBeNameofOperator(): 85case SyntaxKind.CatchClause: 86case SyntaxKind.ParenthesizedLambdaExpression: 87case SyntaxKind.SimpleLambdaExpression: 88case SyntaxKind.AnonymousMethodExpression: 89case SyntaxKind.CatchFilterClause: 90case SyntaxKind.SwitchSection: 91case SyntaxKind.EqualsValueClause: 92case SyntaxKind.Attribute: 93case SyntaxKind.ArgumentList: 94case SyntaxKind.ArrowExpressionClause: 95case SyntaxKind.SwitchExpression: 96case SyntaxKind.SwitchExpressionArm: 97case SyntaxKind.BaseConstructorInitializer: 98case SyntaxKind.ThisConstructorInitializer: 99case SyntaxKind.ConstructorDeclaration: 100case SyntaxKind.PrimaryConstructorBaseType: 101case SyntaxKind.CheckedExpression: 102case SyntaxKind.UncheckedExpression: 105case SyntaxKind.RecordStructDeclaration: 119case SyntaxKind.SimpleLambdaExpression: 120case SyntaxKind.ParenthesizedLambdaExpression: 123case SyntaxKind.SwitchStatement: 126case SyntaxKind.ForStatement: 130case SyntaxKind.ForEachStatement: 131case SyntaxKind.ForEachVariableStatement: 150if (node.Parent.IsKind(SyntaxKind.CastExpression)) 155while (node.Parent.IsKind(SyntaxKind.ConditionalExpression)) 170case SyntaxKind.EqualsValueClause: 174return variableDeclarator.IsKind(SyntaxKind.VariableDeclarator) && 175variableDeclarator.Parent.IsKind(SyntaxKind.VariableDeclaration); 178case SyntaxKind.SimpleAssignmentExpression: 180return parentNode.Parent.IsKind(SyntaxKind.ExpressionStatement); 200case SyntaxKind.IdentifierName: 203case SyntaxKind.SimpleMemberAccessExpression: 207case SyntaxKind.ConditionalAccessExpression: 209if (input.Kind() == SyntaxKind.MemberBindingExpression) 250if (syntax.Kind() == SyntaxKind.RefType) 253refKind = refType.ReadOnlyKeyword.Kind() == SyntaxKind.ReadOnlyKeyword 353if (expression.Kind() == SyntaxKind.InvocationExpression) 358return invocationTarget.Kind() == SyntaxKind.IdentifierName &&
Syntax\SyntaxNodeRemover.cs (17)
123/// be true for <see cref="SyntaxKind.EndOfLineTrivia"/>, <see cref="SyntaxKind.SingleLineCommentTrivia"/>, 128return trivia.Kind() == SyntaxKind.EndOfLineTrivia 129|| trivia.Kind() == SyntaxKind.SingleLineCommentTrivia 140if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 196if (result.Kind() != SyntaxKind.None && _residualTrivia != null && _residualTrivia.Count > 0) 243withSeps, i, (int)SyntaxKind.EndOfLineTrivia, 279if (alternate != null && visited.Kind() != SyntaxKind.None) 444else if (directive.Kind() == SyntaxKind.DefineDirectiveTrivia || 445directive.Kind() == SyntaxKind.UndefDirectiveTrivia) 473if (directiveTriviaListIndex >= 1 && triviaList[directiveTriviaListIndex - 1] is { RawKind: (int)SyntaxKind.WhitespaceTrivia } indentationTrivia) 500case SyntaxKind.IfDirectiveTrivia: 501case SyntaxKind.ElseDirectiveTrivia: 502case SyntaxKind.ElifDirectiveTrivia: 503case SyntaxKind.EndIfDirectiveTrivia: 504case SyntaxKind.RegionDirectiveTrivia: 505case SyntaxKind.EndRegionDirectiveTrivia:
Syntax\SyntaxNormalizer.cs (234)
86if (token.Kind() == SyntaxKind.None || (token.IsMissing && token.FullWidth == 0)) 129if (syntaxToken.LeadingTrivia[^2].IsKind(SyntaxKind.MultiLineDocumentationCommentTrivia) && 130syntaxToken.LeadingTrivia[^1].IsKind(SyntaxKind.EndOfLineTrivia)) 149t => SyntaxToken.NonZeroWidth(t) || t.Kind() == SyntaxKind.EndOfDirectiveToken, 150t => t.Kind() == SyntaxKind.SkippedTokensTrivia); 190return !token.IsKind(SyntaxKind.EndOfFileToken); 200if (currentToken.IsKind(SyntaxKind.EndOfDirectiveToken)) 205if (nextToken.Kind() == SyntaxKind.None) 216if (nextToken.IsKind(SyntaxKind.CloseBraceToken)) 232case SyntaxKind.None: 235case SyntaxKind.OpenBraceToken: 238case SyntaxKind.FinallyKeyword: 241case SyntaxKind.CloseBraceToken: 244case SyntaxKind.CloseParenToken: 251if (nextToken.IsKind(SyntaxKind.OpenBraceToken) && 263|| nextToken.Kind() == SyntaxKind.OpenBraceToken 264|| nextToken.Kind() == SyntaxKind.WhereKeyword) ? 1 : 0; 266case SyntaxKind.CloseBracketToken: 273case SyntaxKind.SemicolonToken: 276case SyntaxKind.CommaToken: 283case SyntaxKind.ElseKeyword: 284return nextToken.Kind() != SyntaxKind.IfKeyword ? 1 : 0; 285case SyntaxKind.ColonToken: 291case SyntaxKind.SwitchKeyword when currentToken.Parent is SwitchExpressionSyntax: 295if ((nextToken.IsKind(SyntaxKind.FromKeyword) && nextToken.Parent.IsKind(SyntaxKind.FromClause)) || 296(nextToken.IsKind(SyntaxKind.LetKeyword) && nextToken.Parent.IsKind(SyntaxKind.LetClause)) || 297(nextToken.IsKind(SyntaxKind.WhereKeyword) && nextToken.Parent.IsKind(SyntaxKind.WhereClause)) || 298(nextToken.IsKind(SyntaxKind.JoinKeyword) && nextToken.Parent.IsKind(SyntaxKind.JoinClause)) || 299(nextToken.IsKind(SyntaxKind.JoinKeyword) && nextToken.Parent.IsKind(SyntaxKind.JoinIntoClause)) || 300(nextToken.IsKind(SyntaxKind.OrderByKeyword) && nextToken.Parent.IsKind(SyntaxKind.OrderByClause)) || 301(nextToken.IsKind(SyntaxKind.SelectKeyword) && nextToken.Parent.IsKind(SyntaxKind.SelectClause)) || 302(nextToken.IsKind(SyntaxKind.GroupKeyword) && nextToken.Parent.IsKind(SyntaxKind.GroupClause))) 309case SyntaxKind.OpenBraceToken: 311case SyntaxKind.CloseBraceToken: 313case SyntaxKind.ElseKeyword: 314case SyntaxKind.FinallyKeyword: 316case SyntaxKind.OpenBracketToken: 318case SyntaxKind.WhereKeyword: 334Debug.Assert(openBraceToken.IsKind(SyntaxKind.OpenBraceToken)); 336if (parent.IsKind(SyntaxKind.Interpolation) || 351Debug.Assert(closeBraceToken.IsKind(SyntaxKind.CloseBraceToken)); 353if (parent.IsKind(SyntaxKind.Interpolation) || 369parent.IsKind(SyntaxKind.Interpolation) || 385currentTokenParent.IsKind(SyntaxKind.Interpolation) || 405var kind = nextToken.Kind(); 408case SyntaxKind.EndOfFileToken: 409case SyntaxKind.CloseBraceToken: 410case SyntaxKind.CatchKeyword: 411case SyntaxKind.FinallyKeyword: 412case SyntaxKind.ElseKeyword: 415if (kind == SyntaxKind.WhileKeyword && 416nextToken.Parent.IsKind(SyntaxKind.DoStatement)) 427=> currentToken.IsKind(SyntaxKind.CloseBraceToken) && 428nextToken.Kind() is SyntaxKind.CommaToken or SyntaxKind.SemicolonToken; 433if (currentToken.Parent.IsKind(SyntaxKind.ForStatement)) 437else if (nextToken.Kind() == SyntaxKind.CloseBraceToken) 441else if (currentToken.Parent.IsKind(SyntaxKind.UsingDirective)) 443return nextToken.Parent.IsKind(SyntaxKind.UsingDirective) ? 1 : 2; 445else if (currentToken.Parent.IsKind(SyntaxKind.ExternAliasDirective)) 447return nextToken.Parent.IsKind(SyntaxKind.ExternAliasDirective) ? 1 : 2; 486if (token.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 490else if (next.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 499var tokenIsOpenBrace = token.IsKind(SyntaxKind.OpenBraceToken); 500var nextIsOpenBrace = next.IsKind(SyntaxKind.OpenBraceToken); 501var tokenIsCloseBrace = token.IsKind(SyntaxKind.CloseBraceToken); 502var nextIsCloseBrace = next.IsKind(SyntaxKind.CloseBraceToken); 546if (token.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 550else if (next.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 559var tokenIsOpenParen = token.IsKind(SyntaxKind.OpenParenToken); 560var nextIsOpenParen = next.IsKind(SyntaxKind.OpenParenToken); 561var tokenIsCloseParen = token.IsKind(SyntaxKind.CloseParenToken); 562var nextIsCloseParen = next.IsKind(SyntaxKind.CloseParenToken); 616if (next.IsKind(SyntaxKind.OpenBracketToken)) 622if (token.IsKind(SyntaxKind.OpenBracketToken)) 642return !next.IsKind(SyntaxKind.SemicolonToken); 650if (next.Kind() == SyntaxKind.EndOfDirectiveToken) 665if (token.IsKind(SyntaxKind.GreaterThanToken) && token.Parent.IsKind(SyntaxKind.TypeArgumentList)) 673if (token.IsKind(SyntaxKind.GreaterThanToken) && 674token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList) && 680if (token.IsKind(SyntaxKind.CommaToken) && 681!next.IsKind(SyntaxKind.CommaToken) && 682!token.Parent.IsKind(SyntaxKind.EnumDeclaration)) 687if (token.Kind() == SyntaxKind.SemicolonToken 688&& !(next.Kind() == SyntaxKind.SemicolonToken || next.Kind() == SyntaxKind.CloseParenToken)) 693if (next.IsKind(SyntaxKind.SwitchKeyword) && next.Parent is SwitchExpressionSyntax) 698if (token.IsKind(SyntaxKind.QuestionToken)) 700if (token.Parent.IsKind(SyntaxKind.ConditionalExpression) || token.Parent is TypeSyntax) 702if (token.Parent.Parent?.Kind() is not SyntaxKind.TypeArgumentList and not SyntaxKind.UsingDirective) 709if (token.IsKind(SyntaxKind.ColonToken)) 711return !token.Parent.IsKind(SyntaxKind.InterpolationFormatClause) && 712!token.Parent.IsKind(SyntaxKind.XmlPrefix) && 713!token.Parent.IsKind(SyntaxKind.IgnoredDirectiveTrivia); 716if (next.IsKind(SyntaxKind.ColonToken)) 718if (next.Parent.IsKind(SyntaxKind.BaseList) || 719next.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause) || 726if (token.IsKind(SyntaxKind.CloseBracketToken) && IsWord(next.Kind())) 732if (token.IsKind(SyntaxKind.CloseParenToken) && IsWord(next.Kind()) && token.Parent.IsKind(SyntaxKind.TupleType) == true) 737if ((next.IsKind(SyntaxKind.QuestionToken) || next.IsKind(SyntaxKind.ColonToken)) 738&& (next.Parent.IsKind(SyntaxKind.ConditionalExpression))) 743if (token.IsKind(SyntaxKind.EqualsToken)) 745return !token.Parent.IsKind(SyntaxKind.XmlTextAttribute); 748if (next.IsKind(SyntaxKind.EqualsToken)) 750return !next.Parent.IsKind(SyntaxKind.XmlTextAttribute); 755if (token.Parent.IsKind(SyntaxKind.FunctionPointerType)) 758if (next.IsKind(SyntaxKind.AsteriskToken) && token.IsKind(SyntaxKind.DelegateKeyword)) 764if (token.IsKind(SyntaxKind.AsteriskToken) && next.Parent.IsKind(SyntaxKind.FunctionPointerCallingConvention)) 768case SyntaxKind.IdentifierToken: 769case SyntaxKind.ManagedKeyword: 770case SyntaxKind.UnmanagedKeyword: 776if (next.Parent.IsKind(SyntaxKind.FunctionPointerParameterList) && next.IsKind(SyntaxKind.LessThanToken)) 781case SyntaxKind.AsteriskToken: 784case SyntaxKind.ManagedKeyword: 785case SyntaxKind.UnmanagedKeyword: 788case SyntaxKind.CloseBracketToken when token.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList): 795if (token.Parent.IsKind(SyntaxKind.FunctionPointerCallingConvention) && next.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList) && 796next.IsKind(SyntaxKind.OpenBracketToken)) 802if (next.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList) && token.Parent.IsKind(SyntaxKind.FunctionPointerUnmanagedCallingConventionList)) 804if (next.IsKind(SyntaxKind.IdentifierToken)) 806if (token.IsKind(SyntaxKind.OpenBracketToken)) 812else if (token.IsKind(SyntaxKind.CommaToken)) 820if (next.IsKind(SyntaxKind.CommaToken)) 827if (next.IsKind(SyntaxKind.CloseBracketToken)) 835if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 842if (next.IsKind(SyntaxKind.GreaterThanToken) && next.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 847if (token.IsKind(SyntaxKind.EqualsGreaterThanToken) || next.IsKind(SyntaxKind.EqualsGreaterThanToken)) 859if (next.IsKind(SyntaxKind.AsteriskToken) && next.Parent is PointerTypeSyntax) 865if (token.IsKind(SyntaxKind.AsteriskToken) && token.Parent is PointerTypeSyntax && 866(next.IsKind(SyntaxKind.IdentifierToken) || next.Parent.IsKind(SyntaxKind.IndexerDeclaration))) 881next.IsKind(SyntaxKind.OpenBraceToken)) 887token.IsKind(SyntaxKind.OpenBraceToken)) 893next.IsKind(SyntaxKind.CloseBraceToken)) 900if (next is { RawKind: (int)SyntaxKind.OpenParenToken, Parent.Parent: ParenthesizedLambdaExpressionSyntax lambda } && 906if (token.Parent.Parent?.Kind() == SyntaxKind.SuppressNullableWarningExpression) 911if (IsKeyword(token.Kind()) && !token.IsKind(SyntaxKind.ExtensionKeyword)) 913if (!next.IsKind(SyntaxKind.ColonToken) && 914!next.IsKind(SyntaxKind.DotToken) && 915!next.IsKind(SyntaxKind.QuestionToken) && 916!next.IsKind(SyntaxKind.SemicolonToken) && 917!next.IsKind(SyntaxKind.OpenBracketToken) && 918(!next.IsKind(SyntaxKind.OpenParenToken) || KeywordNeedsSeparatorBeforeOpenParen(token.Kind()) || next.Parent.IsKind(SyntaxKind.TupleType)) && 919!next.IsKind(SyntaxKind.CloseParenToken) && 920!next.IsKind(SyntaxKind.CloseBraceToken) && 921!next.IsKind(SyntaxKind.ColonColonToken) && 922!next.IsKind(SyntaxKind.GreaterThanToken) && 923!next.IsKind(SyntaxKind.CommaToken)) 951case SyntaxKind.AndKeyword: 952case SyntaxKind.OrKeyword: 958case SyntaxKind.AndKeyword: 959case SyntaxKind.OrKeyword: 960case SyntaxKind.NotKeyword: 981case (SyntaxKind.LineSpanDirectiveTrivia, SyntaxKind.LineDirectivePosition): 982case (SyntaxKind.LineDirectivePosition, SyntaxKind.LineSpanDirectiveTrivia): 989private static bool KeywordNeedsSeparatorBeforeOpenParen(SyntaxKind kind) 993case SyntaxKind.TypeOfKeyword: 994case SyntaxKind.DefaultKeyword: 995case SyntaxKind.NewKeyword: 996case SyntaxKind.BaseKeyword: 997case SyntaxKind.ThisKeyword: 998case SyntaxKind.CheckedKeyword: 999case SyntaxKind.UncheckedKeyword: 1000case SyntaxKind.SizeOfKeyword: 1001case SyntaxKind.ArgListKeyword: 1008private static bool IsXmlTextToken(SyntaxKind kind) 1012case SyntaxKind.XmlTextLiteralNewLineToken: 1013case SyntaxKind.XmlTextLiteralToken: 1020private static bool BinaryTokenNeedsSeparator(SyntaxKind kind) 1024case SyntaxKind.DotToken: 1025case SyntaxKind.MinusGreaterThanToken: 1028return SyntaxFacts.GetBinaryExpression(kind) != SyntaxKind.None; 1032private static bool AssignmentTokenNeedsSeparator(SyntaxKind kind) 1034return SyntaxFacts.GetAssignmentExpression(kind) != SyntaxKind.None; 1050if (trivia.IsKind(SyntaxKind.WhitespaceTrivia) || 1051trivia.IsKind(SyntaxKind.EndOfLineTrivia) || 1091else if (trivia.IsKind(SyntaxKind.DocumentationCommentExteriorTrivia)) 1188case SyntaxKind.None: 1189case SyntaxKind.WhitespaceTrivia: 1190case SyntaxKind.DocumentationCommentExteriorTrivia: 1205var kind = trivia.Kind(); 1208case SyntaxKind.DocumentationCommentExteriorTrivia: 1217var kind = trivia.Kind(); 1220case SyntaxKind.SingleLineCommentTrivia: 1222case SyntaxKind.MultiLineCommentTrivia: 1233case SyntaxKind.SingleLineCommentTrivia: 1234case SyntaxKind.MultiLineCommentTrivia: 1235case SyntaxKind.DocumentationCommentExteriorTrivia: 1236case SyntaxKind.SingleLineDocumentationCommentTrivia: 1237case SyntaxKind.MultiLineDocumentationCommentTrivia: 1246return token.Kind() == SyntaxKind.XmlTextLiteralNewLineToken; 1251if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 1256if (trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia || trivia.Kind() == SyntaxKind.DisabledTextTrivia) 1272return !node.IsKind(SyntaxKind.MultiLineDocumentationCommentTrivia) && IsLineBreak(node.GetLastToken()); 1279private static bool IsWord(SyntaxKind kind) 1281return kind == SyntaxKind.IdentifierToken || IsKeyword(kind); 1284private static bool IsWordOrLiteral(SyntaxKind kind) 1288|| kind == SyntaxKind.InterpolatedStringEndToken 1289|| kind == SyntaxKind.InterpolatedRawStringEndToken; 1292private static bool IsKeyword(SyntaxKind kind) 1343if (node.Parent.IsKind(SyntaxKind.CompilationUnit)) 1350if (node.Parent.Kind() is SyntaxKind.GlobalStatement or SyntaxKind.FileScopedNamespaceDeclaration) 1355if (node.IsKind(SyntaxKind.IfStatement) && node.Parent.IsKind(SyntaxKind.ElseClause)) 1478if (node.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken) 1509SyntaxKind nextTokenKind = GetNextRelevantToken(node.EndQuoteToken).Kind(); 1510return nextTokenKind != SyntaxKind.GreaterThanToken && nextTokenKind != SyntaxKind.SlashGreaterThanToken
Syntax\SyntaxTokenParser.cs (8)
60/// of <see cref="SyntaxKind.None"/>, <see cref="SyntaxToken.IsMissing"/> set to <see langword="true"/>, and a parent of <see langword="null"/>. The 68var containingToken = InternalSyntax.SyntaxFactory.MissingToken(leading: leadingTrivia.Node, SyntaxKind.None, trailing: null); 75/// of <see cref="SyntaxKind.None"/>, <see cref="SyntaxToken.IsMissing"/> set to <see langword="true"/>, and a parent of <see langword="null"/>. The 83var containingToken = InternalSyntax.SyntaxFactory.MissingToken(leading: null, SyntaxKind.None, trailing: trailingTrivia.Node); 125/// will return <see cref="SyntaxKind.None"/>. 127public readonly SyntaxKind ContextualKind 131var contextualKind = Token.ContextualKind(); 132return contextualKind == Token.Kind() ? SyntaxKind.None : contextualKind;
Syntax\TypeDeclarationSyntax.cs (36)
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: 130return SyntaxFactory.StructDeclaration(SyntaxKind.StructDeclaration, attributes, modifiers, keyword, identifier, typeParameterList, parameterList: null, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); 131case SyntaxKind.UnionDeclaration: 132return SyntaxFactory.StructDeclaration(SyntaxKind.UnionDeclaration, attributes, modifiers, keyword, identifier, typeParameterList, parameterList: null, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); 133case SyntaxKind.InterfaceDeclaration: 135case SyntaxKind.RecordDeclaration: 136return SyntaxFactory.RecordDeclaration(SyntaxKind.RecordDeclaration, attributes, modifiers, keyword, classOrStructKeyword: default, identifier, typeParameterList, parameterList: null, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken); 137case SyntaxKind.RecordStructDeclaration: 138return SyntaxFactory.RecordDeclaration(SyntaxKind.RecordStructDeclaration, attributes, modifiers, keyword, classOrStructKeyword: SyntaxFactory.Token(SyntaxKind.StructKeyword), identifier, typeParameterList, parameterList: null, baseList, constraintClauses, openBraceToken, members, closeBraceToken, semicolonToken);
Syntax\UsingDirectiveSyntax.cs (2)
38=> UsingDirective(globalKeyword: default, usingKeyword: Token(SyntaxKind.UsingKeyword), staticKeyword, unsafeKeyword: default, alias, namespaceOrType: name, semicolonToken: Token(SyntaxKind.SemicolonToken));
Syntax\YieldStatementSyntax.cs (1)
20public static YieldStatementSyntax YieldStatement(SyntaxKind kind, SyntaxToken yieldKeyword, SyntaxToken returnOrBreakKeyword, ExpressionSyntax expression, SyntaxToken semicolonToken)
Microsoft.CodeAnalysis.CSharp.Analyzers (27)
CSharpUpgradeMSBuildWorkspaceAnalyzer.cs (1)
17context.RegisterSyntaxNodeAction(AnalyzeIdentifier, SyntaxKind.IdentifierName);
MetaAnalyzers\CSharpDiagnosticAnalyzerAPIUsageAnalyzer.cs (5)
18SyntaxKind.ClassDeclaration 19or SyntaxKind.StructDeclaration 20or SyntaxKind.EnumDeclaration 21or SyntaxKind.RecordDeclaration 22or SyntaxKind.InterfaceDeclaration => true,
MetaAnalyzers\CSharpRegisterActionAnalyzer.cs (7)
15public class CSharpRegisterActionAnalyzer : RegisterActionAnalyzer<InvocationExpressionSyntax, ArgumentSyntax, SyntaxKind> 52protected override SyntaxKind InvocationExpressionKind => SyntaxKind.InvocationExpression; 53protected override SyntaxKind ArgumentSyntaxKind => SyntaxKind.Argument; 54protected override SyntaxKind ParameterSyntaxKind => SyntaxKind.Parameter;
MetaAnalyzers\CSharpSymbolIsBannedInAnalyzersAnalyzer.cs (7)
15public sealed class CSharpSymbolIsBannedInAnalyzersAnalyzer : SymbolIsBannedInAnalyzersAnalyzer<SyntaxKind> 17protected override SyntaxKind XmlCrefSyntaxKind => SyntaxKind.XmlCrefAttribute; 19protected override ImmutableArray<SyntaxKind> BaseTypeSyntaxKinds => ImmutableArray.Create(SyntaxKind.BaseList); 28=> trivia.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia;
MetaAnalyzers\Fixers\CSharpPreferIsKindFix.cs (7)
28if (binaryExpression.Left.IsKind(SyntaxKind.InvocationExpression) || 29binaryExpression.Left.IsKind(SyntaxKind.ConditionalAccessExpression)) 45if (binaryExpression.Left.IsKind(SyntaxKind.ConditionalAccessExpression)) 50SyntaxKind.SimpleMemberAccessExpression, 54else if (binaryExpression.Left.IsKind(SyntaxKind.InvocationExpression)) 68var negate = binaryExpression.OperatorToken.IsKind(SyntaxKind.ExclamationEqualsToken); 71return SyntaxFactory.PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, newInvocation.WithoutLeadingTrivia()).WithLeadingTrivia(newInvocation.GetLeadingTrivia());
Microsoft.CodeAnalysis.CSharp.CodeStyle (2436)
src\roslyn\src\Analyzers\CSharp\Analyzers\AddAccessibilityModifiers\CSharpAddAccessibilityModifiers.cs (9)
33if (name.Kind() == SyntaxKind.None) 86case SyntaxKind.CompilationUnit: 87case SyntaxKind.FileScopedNamespaceDeclaration: 88case SyntaxKind.NamespaceDeclaration: 92case SyntaxKind.ClassDeclaration: 93case SyntaxKind.RecordDeclaration: 94case SyntaxKind.StructDeclaration: 95case SyntaxKind.RecordStructDeclaration: 99case SyntaxKind.InterfaceDeclaration:
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (23)
33SyntaxKind.IfStatement, 34SyntaxKind.ElseClause, 35SyntaxKind.ForStatement, 36SyntaxKind.ForEachStatement, 37SyntaxKind.ForEachVariableStatement, 38SyntaxKind.WhileStatement, 39SyntaxKind.DoStatement, 40SyntaxKind.UsingStatement, 41SyntaxKind.LockStatement, 42SyntaxKind.FixedStatement); 62case SyntaxKind.Block: 66case SyntaxKind.IfStatement when statement.Kind() == SyntaxKind.ElseClause: 77case SyntaxKind.LockStatement: 78case SyntaxKind.UsingStatement: 79case SyntaxKind.FixedStatement: 238if (statement.Kind() is not (SyntaxKind.IfStatement or SyntaxKind.ElseClause)) 267if (ifStatementOrElseClause.IsKind(SyntaxKind.ElseClause)) 273Debug.Assert(ifStatementOrElseClause.IsKind(SyntaxKind.IfStatement)); 277while (result.IsParentKind(SyntaxKind.ElseClause)) 292if (statement.Statement.IsKind(SyntaxKind.Block)) 296if (elseStatement.IsKind(SyntaxKind.Block))
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredExpressionParenthesesDiagnosticAnalyzer.cs (26)
18ExpressionSyntax, ExpressionSyntax, SyntaxKind>(CSharpExpressionPrecedenceService.Instance) 20private static readonly ImmutableArray<SyntaxKind> s_kinds = 22SyntaxKind.AddExpression, 23SyntaxKind.SubtractExpression, 24SyntaxKind.MultiplyExpression, 25SyntaxKind.DivideExpression, 26SyntaxKind.ModuloExpression, 27SyntaxKind.LeftShiftExpression, 28SyntaxKind.RightShiftExpression, 29SyntaxKind.LogicalOrExpression, 30SyntaxKind.LogicalAndExpression, 31SyntaxKind.BitwiseOrExpression, 32SyntaxKind.BitwiseAndExpression, 33SyntaxKind.ExclusiveOrExpression, 34SyntaxKind.EqualsExpression, 35SyntaxKind.NotEqualsExpression, 36SyntaxKind.LessThanExpression, 37SyntaxKind.LessThanOrEqualExpression, 38SyntaxKind.GreaterThanExpression, 39SyntaxKind.GreaterThanOrEqualExpression, 40SyntaxKind.IsExpression, 41SyntaxKind.AsExpression, 42SyntaxKind.CoalesceExpression, 43SyntaxKind.IsPatternExpression, 46protected override ImmutableArray<SyntaxKind> GetSyntaxNodeKinds() 81=> node.Kind() == SyntaxKind.AsExpression;
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer.cs (5)
18PatternSyntax, BinaryPatternSyntax, SyntaxKind>(CSharpPatternPrecedenceService.Instance) 20private static readonly ImmutableArray<SyntaxKind> s_kinds = [SyntaxKind.AndPattern, SyntaxKind.OrPattern]; 22protected override ImmutableArray<SyntaxKind> GetSyntaxNodeKinds()
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
29=> context.RegisterSyntaxNodeAction(AnalyzeNamespace, SyntaxKind.FileScopedNamespaceDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
29=> context.RegisterSyntaxNodeAction(AnalyzeNamespace, SyntaxKind.NamespaceDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
66var lastPragma = root.GetFirstToken().LeadingTrivia.LastOrDefault(t => t.Kind() is SyntaxKind.PragmaWarningDirectiveTrivia);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (5)
58if (!methodDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword) || 132if (member.Modifiers.Any(m => m.Kind() is SyntaxKind.PublicKeyword or SyntaxKind.ProtectedKeyword or SyntaxKind.InternalKeyword)) 135if (!member.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToProgramMainDiagnosticAnalyzer.cs (1)
38context.RegisterSyntaxNodeAction(ProcessCompilationUnit, SyntaxKind.CompilationUnit);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
44context.RegisterSyntaxNodeAction(ProcessCompilationUnit, SyntaxKind.CompilationUnit);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (33)
20private sealed class Analyzer : CSharpSyntaxVisitor<SyntaxKind> 31public static (SyntaxKind nodeToGenerate, VariableDeclaratorSyntax? declaratorToRemoveOpt) Analyze( 37var nodeToGenerate = analyzer.AnalyzeSwitchStatement(node, out shouldRemoveNextStatement); 39if (nodeToGenerate == SyntaxKind.SimpleAssignmentExpression && 84if (!_assignmentTargetOpt.IsKind(SyntaxKind.IdentifierName)) 104public override SyntaxKind VisitSwitchStatement(SwitchStatementSyntax node) 107private SyntaxKind AnalyzeSwitchStatement(SwitchStatementSyntax switchStatement, out bool shouldRemoveNextStatement) 126var nextStatement = AnalyzeNextStatement(switchStatement, out shouldRemoveNextStatement); 175private SyntaxKind AnalyzeNextStatement(SwitchStatementSyntax switchStatement, out bool shouldRemoveNextStatement) 182return SyntaxKind.ThrowStatement; 190private static SyntaxKind Intersect(SyntaxKind left, SyntaxKind right) 192if (left == SyntaxKind.ThrowStatement) 197if (right == SyntaxKind.ThrowStatement) 210private SyntaxKind AnalyzeNextStatement(StatementSyntax? nextStatement) 213return nextStatement is (kind: SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement) 218private SyntaxKind AnalyzeSwitchSection(SwitchSectionSyntax section) 223case 2 when section.Statements[1].IsKind(SyntaxKind.BreakStatement) || section.Statements[0].IsKind(SyntaxKind.SwitchStatement): 230private static SyntaxKind Aggregate<T>(SyntaxKind seed, SyntaxList<T> nodes, Func<SyntaxKind, T, SyntaxKind> func) 233var result = seed; 248public override SyntaxKind VisitAssignmentExpression(AssignmentExpressionSyntax node) 268public override SyntaxKind VisitExpressionStatement(ExpressionStatementSyntax node) 271public override SyntaxKind VisitReturnStatement(ReturnStatementSyntax node) 279: SyntaxKind.ReturnStatement; 282public override SyntaxKind VisitThrowStatement(ThrowStatementSyntax node) 286return node.Expression is null ? default : SyntaxKind.ThrowStatement; 289public override SyntaxKind DefaultVisit(SyntaxNode node)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs (1)
34context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.SwitchStatement);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionHelpers.cs (4)
14if (node.IsKind(SyntaxKind.DefaultSwitchLabel)) 22if (@case.Pattern.IsKind(SyntaxKind.DiscardPattern)) 30varPattern.Designation.Kind() is SyntaxKind.DiscardDesignation or SyntaxKind.SingleVariableDesignation)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertTypeofToNameof\CSharpConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
36and not { Type: PredefinedTypeSyntax { Keyword.RawKind: (int)SyntaxKind.VoidKeyword } };
src\roslyn\src\Analyzers\CSharp\Analyzers\FileHeaders\CSharpFileHeaderHelper.cs (2)
22if (commentTrivia.IsKind(SyntaxKind.SingleLineCommentTrivia)) 26else if (commentTrivia.IsKind(SyntaxKind.MultiLineCommentTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\ForEachCast\CSharpForEachCastDiagnosticAnalyzer.cs (4)
17SyntaxKind, 23protected override ImmutableArray<SyntaxKind> GetSyntaxKinds() 24=> [SyntaxKind.ForEachStatement, SyntaxKind.ForEachVariableStatement];
src\roslyn\src\Analyzers\CSharp\Analyzers\HiddenExplicitCast\CSharpHiddenExplicitCastDiagnosticAnalyzer.cs (1)
30=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.CastExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (13)
57compilationContext.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 59syntaxContext => AnalyzeSyntaxNode(syntaxContext, expressionType), SyntaxKind.Argument)); 81if (argumentNode.RefOrOutKeyword.Kind() != SyntaxKind.OutKeyword) 102if (invocationOrCreation?.Kind() is not SyntaxKind.InvocationExpression and not SyntaxKind.ObjectCreationExpression) 293case SyntaxKind.WhileStatement: 294case SyntaxKind.DoStatement: 295case SyntaxKind.ForStatement: 296case SyntaxKind.ForEachStatement: 297case SyntaxKind.UsingStatement: 298case SyntaxKind.FixedStatement: 299case SyntaxKind.TryStatement: 318return current.IsParentKind(SyntaxKind.Block)
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (7)
35=> context.RegisterSyntaxNodeAction(SyntaxNodeAction, SyntaxKind.IfStatement); 56if (!ifStatement.Condition.IsKind(SyntaxKind.NotEqualsExpression)) 119if (condition.Left.IsKind(SyntaxKind.NullLiteralExpression) || 120condition.Right.IsKind(SyntaxKind.NullLiteralExpression)) 122var expr = condition.Left.IsKind(SyntaxKind.NullLiteralExpression) 309=> left.IsKind(SyntaxKind.IdentifierName) && right.IsKind(SyntaxKind.NullLiteralExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticDiagnosticAnalyzer.cs (4)
35context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression); 46if (anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeFieldReadonly\CSharpMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
15: AbstractMakeFieldReadonlyDiagnosticAnalyzer<SyntaxKind, ThisExpressionSyntax>
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticDiagnosticAnalyzer.cs (2)
32context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.LocalFunctionStatement); 38if (localFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
186property.Modifiers.Any(SyntaxKind.ReadOnlyKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
51}, SyntaxKind.ThisExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\MatchFolderAndNamespace\CSharpMatchFolderAndNamespaceDiagnosticAnalyzer.cs (4)
24: AbstractMatchFolderAndNamespaceDiagnosticAnalyzer<SyntaxKind, BaseNamespaceDeclarationSyntax> 36protected override ImmutableArray<SyntaxKind> GetSyntaxKindsToAnalyze() 37=> [SyntaxKind.NamespaceDeclaration, SyntaxKind.FileScopedNamespaceDeclaration];
src\roslyn\src\Analyzers\CSharp\Analyzers\MisplacedUsingDirectives\MisplacedUsingDirectivesDiagnosticAnalyzer.cs (6)
53context.RegisterSyntaxNodeAction(AnalyzeNamespaceNode, SyntaxKind.NamespaceDeclaration, SyntaxKind.FileScopedNamespaceDeclaration); 54context.RegisterSyntaxNodeAction(AnalyzeCompilationUnitNode, SyntaxKind.CompilationUnit); 103t => t.Kind() is not (SyntaxKind.UsingDirective or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration));
src\roslyn\src\Analyzers\CSharp\Analyzers\NamingStyle\CSharpNamingStyleDiagnosticAnalyzer.cs (9)
15internal sealed class CSharpNamingStyleDiagnosticAnalyzer : NamingStyleDiagnosticAnalyzerBase<SyntaxKind> 17protected override ImmutableArray<SyntaxKind> SupportedSyntaxKinds { get; } = 19SyntaxKind.VariableDeclarator, 20SyntaxKind.ForEachStatement, 21SyntaxKind.CatchDeclaration, 22SyntaxKind.SingleVariableDesignation, 23SyntaxKind.LocalFunctionStatement, 24SyntaxKind.Parameter, 25SyntaxKind.TypeParameter,
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (5)
101if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 111SyntaxKind.IfDirectiveTrivia or SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementDiagnosticAnalyzer.cs (6)
33=> context.RegisterSyntaxNodeAction(ProcessConditionalExpression, SyntaxKind.ConditionalExpression); 77if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 87SyntaxKind.IfDirectiveTrivia or SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (3)
98if (!token.IsKind(SyntaxKind.CloseBraceToken)) 102if (!nextToken.IsKind(SyntaxKind.CloseBraceToken)) 127endOfLineTrivia = secondBrace.LeadingTrivia.Last(t => t.IsKind(SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
86if (colonToken.TrailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia)
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (4)
93var parentIsElseClause = parent.IsKind(SyntaxKind.ElseClause); 99if (statement.IsKind(SyntaxKind.IfStatement) && parentIsElseClause) 111if (parent.IsKind(SyntaxKind.Block)) 133if (trivia.IsKind(SyntaxKind.EndOfLineTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\OrderModifiers\CSharpOrderModifiersHelper.cs (3)
21var kind = SyntaxFacts.GetKeywordKind(trimmed); 22return (int)(kind == SyntaxKind.None ? SyntaxFacts.GetContextualKeywordKind(trimmed) : kind); 31parsed[(int)SyntaxKind.PartialKeyword] = int.MaxValue;
src\roslyn\src\Analyzers\CSharp\Analyzers\QualifyMemberAccess\CSharpQualifyMemberAccessDiagnosticAnalyzer.cs (6)
18: AbstractQualifyMemberAccessDiagnosticAnalyzer<SyntaxKind, ExpressionSyntax, SimpleNameSyntax> 24=> node.IsKind(SyntaxKind.ThisExpression); 38if (node.IsKind(SyntaxKind.BaseExpression)) 44if (node.Parent is AssignmentExpressionSyntax { Parent: InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression), Left: var left } && 62=> declarationSyntax.IsKind(SyntaxKind.PropertyDeclaration) && declarationSyntax.Contains(node); 65=> declarationSyntax.GetAncestorsOrThis(n => n.IsKind(SyntaxKind.FieldDeclaration) && n.Contains(node)).Any();
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs (3)
26=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.IsExpression, SyntaxKind.IsPatternExpression); 38if (left.Kind() != SyntaxKind.SuppressNullableWarningExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryAsyncModifier\CSharpMakeMethodSynchronousDiagnosticAnalyzer.cs (1)
90if (modifier.Kind() == SyntaxKind.AsyncKeyword)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (4)
20: AbstractRemoveUnnecessaryCastDiagnosticAnalyzer<SyntaxKind, ExpressionSyntax> 22protected override ImmutableArray<SyntaxKind> SyntaxKindsOfInterest { get; } = 23[SyntaxKind.CastExpression, SyntaxKind.AsExpression];
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
40context.RegisterSyntaxNodeAction(AnalyzeDiscardDesignation, SyntaxKind.DiscardDesignation);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (5)
50SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression); 75if (anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword)) 83if (wasAwaited != anonymousFunction.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (14)
55if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia)) 96case SyntaxKind.NullableDirectiveTrivia: 107case SyntaxKind.IfDirectiveTrivia or 108SyntaxKind.ElifDirectiveTrivia or 109SyntaxKind.ElseDirectiveTrivia or 110SyntaxKind.EndIfDirectiveTrivia: 120if (!directive.TargetToken.IsKind(SyntaxKind.None)) 128if (directive.TargetToken.IsKind(SyntaxKind.AnnotationsKeyword)) 132else if (directive.TargetToken.IsKind(SyntaxKind.WarningsKeyword)) 141if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 145else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 155if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 159else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 163else if (directive.SettingToken.IsKind(SyntaxKind.RestoreKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (13)
56SyntaxKind.CompilationUnit or 57SyntaxKind.ClassDeclaration or 58SyntaxKind.RecordDeclaration or 59SyntaxKind.StructDeclaration or 60SyntaxKind.RecordStructDeclaration or 61SyntaxKind.InterfaceDeclaration or 62SyntaxKind.DelegateDeclaration or 63SyntaxKind.EnumDeclaration; 135SyntaxKind.IfDirectiveTrivia or 136SyntaxKind.ElifDirectiveTrivia or 137SyntaxKind.ElseDirectiveTrivia) 272if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia)) 293if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (5)
73if (node.IsParentKind(SyntaxKind.UsingDirective)) 79if (node.IsParentKind(SyntaxKind.SimpleBaseType)) 91if (node.IsParentKind(SyntaxKind.NameEquals) && node.Parent.IsParentKind(SyntaxKind.UsingDirective)) 101if (node.IsParentKind(SyntaxKind.Attribute))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryParentheses\CSharpRemoveUnnecessaryExpressionParenthesesDiagnosticAnalyzer.cs (3)
19: AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer<SyntaxKind, ParenthesizedExpressionSyntax> 21protected override SyntaxKind GetSyntaxKind() 22=> SyntaxKind.ParenthesizedExpression;
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryParentheses\CSharpRemoveUnnecessaryPatternParenthesesDiagnosticAnalyzer.cs (3)
19: AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer<SyntaxKind, ParenthesizedPatternSyntax> 21protected override SyntaxKind GetSyntaxKind() 22=> SyntaxKind.ParenthesizedPattern;
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (3)
22case SyntaxKind.AssemblyKeyword: 23case SyntaxKind.ModuleKeyword: 31}, SyntaxKind.AttributeList);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
24=> (typeof(SyntaxKind).Assembly, CompilerDiagnosticAnalyzerNames.CSharpCompilerAnalyzerTypeName); 26=> root.ContainsDirective(SyntaxKind.PragmaWarningDirectiveTrivia);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\UnnecessaryNullableWarningSuppressionsUtilities.cs (1)
26if (node is not PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfixUnary)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryUnsafeModifier\UnnecessaryUnsafeModifierUtilities.cs (1)
145if (modifier.Kind() == SyntaxKind.UnsafeKeyword)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\RemoveUnreachableCodeHelpers.cs (2)
64if (currentStatement.IsKind(SyntaxKind.LabeledStatement)) 74if (currentStatement.IsKind(SyntaxKind.LocalFunctionStatement))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
79!blockOperation.Syntax.IsKind(SyntaxKind.Block);
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyBooleanExpression\CSharpSimplifyConditionalDiagnosticAnalyzer.cs (1)
18SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
35context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, enumerableType), SyntaxKind.InvocationExpression); 72if (whereLambda.Body is not BinaryExpressionSyntax(kind: SyntaxKind.IsExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorDiagnosticAnalyzer.cs (12)
30=> context.RegisterSyntaxNodeAction(AnalyzePropertyDeclaration, SyntaxKind.PropertyDeclaration); 50if (accessor is (SyntaxKind.GetAccessorDeclaration) { Body.Statements: [ReturnStatementSyntax { Expression.RawKind: (int)SyntaxKind.FieldExpression }] } 51or (SyntaxKind.GetAccessorDeclaration) { ExpressionBody.Expression.RawKind: (int)SyntaxKind.FieldExpression }) 57if (accessor is (SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration) { Body.Statements: [ExpressionStatementSyntax { Expression: var innerBlockBodyExpression }] } && 64if (accessor is (SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration) { ExpressionBody.Expression: var innerExpressionBodyExpression } && 73return expression is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) 75Left.RawKind: (int)SyntaxKind.FieldExpression, 86containingPropertyDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternDiagnosticAnalyzer.cs (1)
47context.RegisterSyntaxNodeAction(AnalyzeSubpattern, SyntaxKind.Subpattern);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (10)
21SyntaxKind, 29protected override SyntaxKind PropertyDeclarationKind 30=> SyntaxKind.PropertyDeclaration; 59if (argument.RefKindKeyword.Kind() != SyntaxKind.None) 75if (addressOfExpression.Kind() == SyntaxKind.AddressOfExpression) 155if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) 157Expression: (kind: SyntaxKind.ThisExpression), 158Name: (kind: SyntaxKind.IdentifierName), 163else if (expression.IsKind(SyntaxKind.IdentifierName)) 215if (setExpression is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckDiagnosticAnalyzer.cs (6)
19SyntaxKind, 25protected override SyntaxKind IfStatementKind 26=> SyntaxKind.IfStatement; 42if (condition is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) { Right: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } binary) 47else if (condition is IsPatternExpressionSyntax { Pattern: ConstantPatternSyntax { Expression: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } } isPattern)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer.cs (2)
43protected abstract void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType); 67context.RegisterCodeBlockStartAction<SyntaxKind>(context => InitializeWorker(context, expressionType));
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (3)
29protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 31context.RegisterSyntaxNodeAction(context => AnalyzeArrayInitializerExpression(context, expressionType), SyntaxKind.ArrayInitializerExpression); 32context.RegisterSyntaxNodeAction(context => AnalyzeArrayCreationExpression(context, expressionType), SyntaxKind.ArrayCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (5)
32protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 33=> context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, expressionType), SyntaxKind.InvocationExpression); 110if (invocationExpression.Expression is not MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccessExpression || 149argumentIndex == arguments.Count - 1 && arguments[argumentIndex] is { RefKindKeyword.RawKind: (int)SyntaxKind.OutKeyword, Expression: DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax singleVariable } } 216identifierName.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (2)
22protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 23=> context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, expressionType), SyntaxKind.InvocationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForEmptyDiagnosticAnalyzer.cs (2)
23protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 24=> context.RegisterSyntaxNodeAction(context => AnalyzeMemberAccess(context, expressionType), SyntaxKind.SimpleMemberAccessExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (4)
65protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 66=> context.RegisterSyntaxNodeAction(context => AnalyzeMemberAccess(context, expressionType), SyntaxKind.SimpleMemberAccessExpression); 221Initializer: null or { RawKind: (int)SyntaxKind.CollectionInitializerExpression } 403if (memberAccess.Kind() != SyntaxKind.SimpleMemberAccessExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (3)
26protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 28context.RegisterSyntaxNodeAction(context => AnalyzeObjectCreationExpression(context, expressionType), SyntaxKind.ObjectCreationExpression); 29context.RegisterSyntaxNodeAction(context => AnalyzeImplicitObjectCreationExpression(context, expressionType), SyntaxKind.ImplicitObjectCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (3)
35protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 37context.RegisterSyntaxNodeAction(context => AnalyzeExplicitStackAllocExpression(context, expressionType), SyntaxKind.StackAllocArrayCreationExpression); 38context.RegisterSyntaxNodeAction(context => AnalyzeImplicitStackAllocExpression(context, expressionType), SyntaxKind.ImplicitStackAllocArrayCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (5)
580siblingArgument.RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword && 614if (openBracket.TrailingTrivia is [(kind: SyntaxKind.WhitespaceTrivia), ..]) 617if (elements is [.., var lastNodeOrToken] && lastNodeOrToken.GetTrailingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia)] trailingTrivia) 886RawKind: (int)SyntaxKind.SimpleMemberAccessExpression, 1041if (objectCreation.Initializer.IsKind(SyntaxKind.ObjectCreationExpression) && objectCreation.Initializer.Expressions.Count > 0)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (4)
37if (expression is InitializerExpressionSyntax(SyntaxKind.ComplexElementInitializerExpression) initializer) 54if (_objectCreationExpression.Initializer is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression) 201if (binaryExpression.Kind() != SyntaxKind.AddExpression) 250if (current is not MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) { Name.Identifier.ValueText: "Length" or "Count" } memberAccess)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
27SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundAssignmentDiagnosticAnalyzer.cs (10)
15: AbstractUseCompoundAssignmentDiagnosticAnalyzer<SyntaxKind, AssignmentExpressionSyntax, BinaryExpressionSyntax>( 18protected override SyntaxKind GetAnalysisKind() 19=> SyntaxKind.SimpleAssignmentExpression; 21protected override bool IsSupported(SyntaxKind assignmentKind, ParseOptions options) 22=> assignmentKind != SyntaxKind.CoalesceExpression || 25protected override int TryGetIncrementOrDecrement(SyntaxKind opKind, object constantValue) 34SyntaxKind.AddExpression => 1, 35SyntaxKind.SubtractExpression => -1, 45SyntaxKind.AddExpression => -1, 46SyntaxKind.SubtractExpression => 1,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (10)
44context.RegisterSyntaxNodeAction(AnalyzeCoalesceExpression, SyntaxKind.CoalesceExpression); 45context.RegisterSyntaxNodeAction(AnalyzeIfStatement, SyntaxKind.IfStatement); 71if (assignment.Kind() != SyntaxKind.SimpleAssignmentExpression) 108assignment = whenTrue is ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignmentTemp } 179if (condition is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) { Right: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } binaryExpression) 188else if (condition is IsPatternExpressionSyntax { Pattern: ConstantPatternSyntax { Expression: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } } isPattern) 198if (arg0.Kind() == SyntaxKind.NullLiteralExpression || 199arg1.Kind() == SyntaxKind.NullLiteralExpression) 204testedExpression = arg0.Kind() == SyntaxKind.NullLiteralExpression ? arg1 : arg0;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\Utilities.cs (30)
11public static readonly ImmutableArray<(SyntaxKind, SyntaxKind, SyntaxKind)> Kinds = 13(SyntaxKind.AddExpression, SyntaxKind.AddAssignmentExpression), 14(SyntaxKind.SubtractExpression, SyntaxKind.SubtractAssignmentExpression), 15(SyntaxKind.MultiplyExpression, SyntaxKind.MultiplyAssignmentExpression), 16(SyntaxKind.DivideExpression, SyntaxKind.DivideAssignmentExpression), 17(SyntaxKind.ModuloExpression, SyntaxKind.ModuloAssignmentExpression), 18(SyntaxKind.BitwiseAndExpression, SyntaxKind.AndAssignmentExpression), 19(SyntaxKind.ExclusiveOrExpression, SyntaxKind.ExclusiveOrAssignmentExpression), 20(SyntaxKind.BitwiseOrExpression, SyntaxKind.OrAssignmentExpression), 21(SyntaxKind.LeftShiftExpression, SyntaxKind.LeftShiftAssignmentExpression), 22(SyntaxKind.RightShiftExpression, SyntaxKind.RightShiftAssignmentExpression), 23(SyntaxKind.CoalesceExpression, SyntaxKind.CoalesceAssignmentExpression)).SelectAsArray( 26private static SyntaxKind FindOperatorToken(SyntaxKind assignmentExpressionKind) 28for (var current = SyntaxKind.None; current <= SyntaxKind.ThrowExpression; current++)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (3)
39SyntaxKind.VariableDeclaration, SyntaxKind.ForEachStatement); 233if (element.Identifier.IsKind(SyntaxKind.None))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (1)
30=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.DefaultExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (7)
30SyntaxKind.GetAccessorDeclaration, 31SyntaxKind.SetAccessorDeclaration, 32SyntaxKind.InitAccessorDeclaration, 33SyntaxKind.AddAccessorDeclaration, 34SyntaxKind.RemoveAccessorDeclaration, 63return !declaration.GetLeadingTrivia().Any(t => t.Kind() == SyntaxKind.EndOfLineTrivia) 69=> declaration.IsKind(SyntaxKind.GetAccessorDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForConstructorsHelper.cs (1)
25[SyntaxKind.ConstructorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForConversionOperatorsHelper.cs (1)
25[SyntaxKind.ConversionOperatorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForIndexersHelper.cs (1)
28[SyntaxKind.IndexerDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForLocalFunctionHelper.cs (2)
28[SyntaxKind.LocalFunctionStatement]) 56if (statement.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (2)
26[SyntaxKind.MethodDeclaration]) 54if (declaration.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForOperatorsHelper.cs (1)
27[SyntaxKind.OperatorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForPropertiesHelper.cs (1)
31[SyntaxKind.PropertyDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper.cs (1)
22public abstract ImmutableArray<SyntaxKind> SyntaxKinds { get; }
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (8)
34ImmutableArray<SyntaxKind> syntaxKinds) : UseExpressionBodyHelper 42public override ImmutableArray<SyntaxKind> SyntaxKinds { get; } = syntaxKinds; 46return accessorList is { Accessors: [{ AttributeLists.Count: 0, RawKind: (int)SyntaxKind.GetAccessorDeclaration } accessor] } 174getAccessor?.GetLeadingTrivia() is not [.., (kind: SyntaxKind.WhitespaceTrivia) whitespace]) 208if (startOfLine && trivia.IsKind(SyntaxKind.WhitespaceTrivia)) 247if (expressionBody.Expression.IsKind(SyntaxKind.ThrowExpression)) 290.Where(t => t.Kind() != SyntaxKind.EndOfLineTrivia) 384var accessor = AccessorDeclaration(SyntaxKind.GetAccessorDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\UseExpressionBodyDiagnosticAnalyzer.cs (4)
20private readonly ImmutableArray<SyntaxKind> _syntaxKinds; 53var nodeKind = context.Node.Kind(); 60if (grandparent.Kind() == SyntaxKind.PropertyDeclaration && 66if (grandparent.Kind() == SyntaxKind.IndexerDeclaration &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (2)
35SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (1)
57if (expressionBodyOpt.IsKind(SyntaxKind.ThrowExpression) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitlyTypedLambdaExpression\CSharpUseImplicitlyTypedLambdaExpressionDiagnosticAnalyzer.cs (2)
34SyntaxKind.ParenthesizedLambdaExpression); 124var paramsModifierIndex = parameter.Modifiers.IndexOf(SyntaxKind.ParamsKeyword);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (6)
32=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.ObjectCreationExpression); 102else if (objectCreation.Parent.IsKind(SyntaxKind.ArrowExpressionClause)) 106LocalFunctionStatementSyntax localFunction => (localFunction.ReturnType, localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword)), 107MethodDeclarationSyntax method => (method.ReturnType, method.Modifiers.Any(SyntaxKind.AsyncKeyword)), 111AccessorDeclarationSyntax(SyntaxKind.GetAccessorDeclaration) { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax baseProperty } } => (baseProperty.Type, false), 124else if (objectCreation.Parent is InitializerExpressionSyntax(kind: SyntaxKind.ArrayInitializerExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (3)
43HandleVariableDeclaration, SyntaxKind.VariableDeclaration, SyntaxKind.ForEachStatement, SyntaxKind.DeclarationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (4)
17=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.NameColon, SyntaxKind.NameEquals); 23case SyntaxKind.NameColon: 26case SyntaxKind.NameEquals:
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (4)
41context.RegisterSyntaxNodeAction(n => AnalyzeSyntax(n), SyntaxKind.EqualsExpression, SyntaxKind.NotEqualsExpression); 61var properties = binaryExpression.Kind() == SyntaxKind.EqualsExpression 73right.IsKind(SyntaxKind.NullLiteralExpression))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer.cs (1)
14internal sealed class CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer : AbstractUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer<SyntaxKind>
src\roslyn\src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (10)
71context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 73SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression)); 330if (containingStatement.IsKind(SyntaxKind.LocalDeclarationStatement, out localDeclaration) && 357if (anonymousFunction?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Parent: ExpressionStatementSyntax expressionStatement } assignment) 359if (assignment.Left.IsKind(SyntaxKind.IdentifierName)) 383SyntaxKind.NullLiteralExpression or 384SyntaxKind.DefaultLiteralExpression or 385SyntaxKind.DefaultExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (2)
42context.RegisterSyntaxNodeAction(AnalyzeAttribute, SyntaxKind.Attribute); 78if (argument.Expression is not LiteralExpressionSyntax(SyntaxKind.StringLiteralExpression) and not InterpolatedStringExpressionSyntax)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNullPropagation\CSharpUseNullPropagationDiagnosticAnalyzer.cs (4)
19SyntaxKind, 33protected override SyntaxKind IfStatementSyntaxKind 34=> SyntaxKind.IfStatement; 53if (pattern is UnaryPatternSyntax(SyntaxKind.NotPattern) notPattern)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseObjectInitializerDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (2)
54SyntaxKind.SimpleAssignmentExpression, 167if (target.Syntax.DescendantNodesAndSelf().OfType<ArgumentSyntax>().Any(a => a.RefKindKeyword.Kind() is SyntaxKind.RefKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (3)
43SyntaxKind.LogicalAndExpression, 44SyntaxKind.LogicalOrExpression, 45SyntaxKind.LogicalNotExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (3)
48context.RegisterSyntaxNodeAction(context => AnalyzeAsExpression(context), SyntaxKind.AsExpression); 99if (binaryExpression.Kind() is SyntaxKind.EqualsExpression) 109else if (binaryExpression.Kind() is SyntaxKind.NotEqualsExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (20)
42Debug.Assert(localStatement.IsKind(SyntaxKind.LocalDeclarationStatement)); 43Debug.Assert(enclosingBlock.Kind() is SyntaxKind.Block or SyntaxKind.SwitchSection); 106var defAssignedWhenTrue = _comparison.Kind() is SyntaxKind.NotEqualsExpression or SyntaxKind.IsExpression; 114case SyntaxKind.LogicalAndExpression when !defAssignedWhenTrue: 115case SyntaxKind.LogicalOrExpression when defAssignedWhenTrue: 126case SyntaxKind.LogicalAndExpression: 127case SyntaxKind.LogicalOrExpression: 130case SyntaxKind.ParenthesizedExpression: 131case SyntaxKind.CastExpression: 135case SyntaxKind.EqualsValueClause: 136case SyntaxKind.VariableDeclarator: 137case SyntaxKind.VariableDeclaration: 140case SyntaxKind.LogicalNotExpression: 145case SyntaxKind.ConditionalExpression: 158case SyntaxKind.ForStatement: 169case SyntaxKind.WhileStatement: 173case SyntaxKind.IfStatement: 282if (_operand.Kind() == SyntaxKind.IdentifierName)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (16)
47=> context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 49SyntaxKind.EqualsExpression, 50SyntaxKind.NotEqualsExpression, 51SyntaxKind.IsExpression, 52SyntaxKind.IsPatternExpression)); 277case SyntaxKind.IdentifierName: 286if (!initializerValue.IsKind(SyntaxKind.AsExpression, out asExpression)) 292case SyntaxKind.SimpleAssignmentExpression: 297if (!assignment.Right.IsKind(SyntaxKind.AsExpression, out asExpression) || 327private static ExpressionSyntax? GetNullCheckOperand(ExpressionSyntax left, SyntaxKind comparisonKind, SyntaxNode right) 329if (left.IsKind(SyntaxKind.NullLiteralExpression)) 336if (right.IsKind(SyntaxKind.NullLiteralExpression)) 344&& predefinedType.Keyword.IsKind(SyntaxKind.ObjectKeyword) 345&& comparisonKind == SyntaxKind.IsExpression) 352&& constantPattern.Expression.IsKind(SyntaxKind.NullLiteralExpression) 353&& comparisonKind == SyntaxKind.IsPatternExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (6)
59context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 60blockStartContext.RegisterSyntaxNodeAction(SyntaxNodeAction, SyntaxKind.IsExpression)); 95var ifStatementScope = ifStatement.Parent.IsKind(SyntaxKind.Block) 173if (!isExpression.Parent.IsKind(SyntaxKind.IfStatement, out ifStatement)) 186if (!firstStatement.IsKind(SyntaxKind.LocalDeclarationStatement, out localDeclarationStatement)) 197if (!declaratorValue.IsKind(SyntaxKind.CastExpression, out castExpression))
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpUseNotPatternDiagnosticAnalyzer.cs (3)
46context.RegisterSyntaxNodeAction(n => SyntaxNodeAction(n, expressionOfTType), SyntaxKind.LogicalNotExpression); 63if (node is not PrefixUnaryExpressionSyntax(SyntaxKind.LogicalNotExpression) 81BinaryExpressionSyntax(SyntaxKind.IsExpression) { Right: TypeSyntax type } isExpression
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\UsePatternMatchingHelpers.cs (7)
26if (asExpression.Kind() == SyntaxKind.AsExpression) 54if (conditionalAccessExpression.Parent is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) parentBinaryExpression1 && 65SyntaxKind.NotEqualsExpression or 66SyntaxKind.GreaterThanExpression or 67SyntaxKind.GreaterThanOrEqualExpression or 68SyntaxKind.LessThanExpression or 69SyntaxKind.LessThanOrEqualExpression) parentBinaryExpression2 &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (5)
363if (constructorDeclaration.Initializer is null or (kind: SyntaxKind.BaseConstructorInitializer)) 377Debug.Assert(constructorDeclaration.Initializer.Kind() == SyntaxKind.ThisConstructorInitializer); 472if (assignmentExpression.Kind() != SyntaxKind.SimpleAssignmentExpression) 482MemberAccessExpressionSyntax(kind: SyntaxKind.SimpleMemberAccessExpression) { Expression: (kind: SyntaxKind.ThisExpression), Name: IdentifierNameSyntax identifierName } => identifierName,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (3)
74context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.UsingStatement); 222=> priorStatement.Kind() is SyntaxKind.GotoStatement or 223SyntaxKind.LabeledStatement;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (2)
58SyntaxKind.LocalDeclarationStatement); 139if (assignmentStatement is not ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment })
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (2)
53SyntaxKind.InvocationExpression); 72if (argument.Kind() != SyntaxKind.OmittedTypeArgument)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
109else if (elements is [{ Syntax.Parent: (kind: SyntaxKind.CollectionInitializerExpression) }, ..])
src\roslyn\src\Analyzers\CSharp\Analyzers\ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs (1)
16AbstractValidateFormatStringDiagnosticAnalyzer<SyntaxKind>
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeGeneration\CSharpSyntaxTokens.cs (97)
11public static readonly SyntaxToken AbstractKeyword = Token(SyntaxKind.AbstractKeyword); 12public static readonly SyntaxToken AsKeyword = Token(SyntaxKind.AsKeyword); 13public static readonly SyntaxToken AssemblyKeyword = Token(SyntaxKind.AssemblyKeyword); 14public static readonly SyntaxToken AsyncKeyword = Token(SyntaxKind.AsyncKeyword); 15public static readonly SyntaxToken AwaitKeyword = Token(SyntaxKind.AwaitKeyword); 16public static readonly SyntaxToken BoolKeyword = Token(SyntaxKind.BoolKeyword); 17public static readonly SyntaxToken BreakKeyword = Token(SyntaxKind.BreakKeyword); 18public static readonly SyntaxToken ByteKeyword = Token(SyntaxKind.ByteKeyword); 19public static readonly SyntaxToken CaseKeyword = Token(SyntaxKind.CaseKeyword); 20public static readonly SyntaxToken CharKeyword = Token(SyntaxKind.CharKeyword); 21public static readonly SyntaxToken CheckedKeyword = Token(SyntaxKind.CheckedKeyword); 22public static readonly SyntaxToken CloseBraceToken = Token(SyntaxKind.CloseBraceToken); 23public static readonly SyntaxToken CloseBracketToken = Token(SyntaxKind.CloseBracketToken); 25public static readonly SyntaxToken ClosedKeyword = Token(SyntaxKind.ClosedKeyword); 27public static readonly SyntaxToken CloseParenToken = Token(SyntaxKind.CloseParenToken); 28public static readonly SyntaxToken ColonToken = Token(SyntaxKind.ColonToken); 29public static readonly SyntaxToken CommaToken = Token(SyntaxKind.CommaToken); 30public static readonly SyntaxToken ConstKeyword = Token(SyntaxKind.ConstKeyword); 31public static readonly SyntaxToken ContinueKeyword = Token(SyntaxKind.ContinueKeyword); 32public static readonly SyntaxToken DecimalKeyword = Token(SyntaxKind.DecimalKeyword); 33public static readonly SyntaxToken DisableKeyword = Token(SyntaxKind.DisableKeyword); 34public static readonly SyntaxToken DotDotToken = Token(SyntaxKind.DotDotToken); 35public static readonly SyntaxToken DoubleKeyword = Token(SyntaxKind.DoubleKeyword); 36public static readonly SyntaxToken EndOfDocumentationCommentToken = Token(SyntaxKind.EndOfDocumentationCommentToken); 37public static readonly SyntaxToken EqualsToken = Token(SyntaxKind.EqualsToken); 38public static readonly SyntaxToken ExplicitKeyword = Token(SyntaxKind.ExplicitKeyword); 40public static readonly SyntaxToken ExtensionKeyword = Token(SyntaxKind.ExtensionKeyword); 42public static readonly SyntaxToken ExternKeyword = Token(SyntaxKind.ExternKeyword); 43public static readonly SyntaxToken FileKeyword = Token(SyntaxKind.FileKeyword); 44public static readonly SyntaxToken FixedKeyword = Token(SyntaxKind.FixedKeyword); 45public static readonly SyntaxToken FloatKeyword = Token(SyntaxKind.FloatKeyword); 46public static readonly SyntaxToken ForEachKeyword = Token(SyntaxKind.ForEachKeyword); 47public static readonly SyntaxToken FromKeyword = Token(SyntaxKind.FromKeyword); 48public static readonly SyntaxToken GlobalKeyword = Token(SyntaxKind.GlobalKeyword); 49public static readonly SyntaxToken GreaterThanEqualsToken = Token(SyntaxKind.GreaterThanEqualsToken); 50public static readonly SyntaxToken GreaterThanToken = Token(SyntaxKind.GreaterThanToken); 51public static readonly SyntaxToken IfKeyword = Token(SyntaxKind.IfKeyword); 52public static readonly SyntaxToken ImplicitKeyword = Token(SyntaxKind.ImplicitKeyword); 53public static readonly SyntaxToken InKeyword = Token(SyntaxKind.InKeyword); 54public static readonly SyntaxToken InterfaceKeyword = Token(SyntaxKind.InterfaceKeyword); 55public static readonly SyntaxToken InternalKeyword = Token(SyntaxKind.InternalKeyword); 56public static readonly SyntaxToken InterpolatedStringEndToken = Token(SyntaxKind.InterpolatedStringEndToken); 57public static readonly SyntaxToken InterpolatedStringStartToken = Token(SyntaxKind.InterpolatedStringStartToken); 58public static readonly SyntaxToken IntKeyword = Token(SyntaxKind.IntKeyword); 59public static readonly SyntaxToken IsKeyword = Token(SyntaxKind.IsKeyword); 60public static readonly SyntaxToken LessThanEqualsToken = Token(SyntaxKind.LessThanEqualsToken); 61public static readonly SyntaxToken LessThanToken = Token(SyntaxKind.LessThanToken); 62public static readonly SyntaxToken LetKeyword = Token(SyntaxKind.LetKeyword); 63public static readonly SyntaxToken LongKeyword = Token(SyntaxKind.LongKeyword); 64public static readonly SyntaxToken MethodKeyword = Token(SyntaxKind.MethodKeyword); 65public static readonly SyntaxToken NewKeyword = Token(SyntaxKind.NewKeyword); 66public static readonly SyntaxToken NotKeyword = Token(SyntaxKind.NotKeyword); 67public static readonly SyntaxToken NullKeyword = Token(SyntaxKind.NullKeyword); 68public static readonly SyntaxToken ObjectKeyword = Token(SyntaxKind.ObjectKeyword); 69public static readonly SyntaxToken OpenBraceToken = Token(SyntaxKind.OpenBraceToken); 70public static readonly SyntaxToken OpenBracketToken = Token(SyntaxKind.OpenBracketToken); 71public static readonly SyntaxToken OpenParenToken = Token(SyntaxKind.OpenParenToken); 72public static readonly SyntaxToken OperatorKeyword = Token(SyntaxKind.OperatorKeyword); 73public static readonly SyntaxToken OutKeyword = Token(SyntaxKind.OutKeyword); 74public static readonly SyntaxToken OverrideKeyword = Token(SyntaxKind.OverrideKeyword); 75public static readonly SyntaxToken ParamsKeyword = Token(SyntaxKind.ParamsKeyword); 76public static readonly SyntaxToken PartialKeyword = Token(SyntaxKind.PartialKeyword); 77public static readonly SyntaxToken PlusToken = Token(SyntaxKind.PlusToken); 78public static readonly SyntaxToken PrivateKeyword = Token(SyntaxKind.PrivateKeyword); 79public static readonly SyntaxToken PropertyKeyword = Token(SyntaxKind.PropertyKeyword); 80public static readonly SyntaxToken ProtectedKeyword = Token(SyntaxKind.ProtectedKeyword); 81public static readonly SyntaxToken PublicKeyword = Token(SyntaxKind.PublicKeyword); 82public static readonly SyntaxToken QuestionQuestionEqualsToken = Token(SyntaxKind.QuestionQuestionEqualsToken); 83public static readonly SyntaxToken QuestionToken = Token(SyntaxKind.QuestionToken); 84public static readonly SyntaxToken ReadOnlyKeyword = Token(SyntaxKind.ReadOnlyKeyword); 85public static readonly SyntaxToken RecordKeyword = Token(SyntaxKind.RecordKeyword); 86public static readonly SyntaxToken RefKeyword = Token(SyntaxKind.RefKeyword); 87public static readonly SyntaxToken RequiredKeyword = Token(SyntaxKind.RequiredKeyword); 88public static readonly SyntaxToken RestoreKeyword = Token(SyntaxKind.RestoreKeyword); 89public static readonly SyntaxToken ReturnKeyword = Token(SyntaxKind.ReturnKeyword); 90public static readonly SyntaxToken SByteKeyword = Token(SyntaxKind.SByteKeyword); 91public static readonly SyntaxToken ScopedKeyword = Token(SyntaxKind.ScopedKeyword); 92public static readonly SyntaxToken SealedKeyword = Token(SyntaxKind.SealedKeyword); 93public static readonly SyntaxToken SemicolonToken = Token(SyntaxKind.SemicolonToken); 94public static readonly SyntaxToken ShortKeyword = Token(SyntaxKind.ShortKeyword); 95public static readonly SyntaxToken SlashGreaterThanToken = Token(SyntaxKind.SlashGreaterThanToken); 96public static readonly SyntaxToken StaticKeyword = Token(SyntaxKind.StaticKeyword); 97public static readonly SyntaxToken StringKeyword = Token(SyntaxKind.StringKeyword); 98public static readonly SyntaxToken StructKeyword = Token(SyntaxKind.StructKeyword); 99public static readonly SyntaxToken SwitchKeyword = Token(SyntaxKind.SwitchKeyword); 100public static readonly SyntaxToken ThisKeyword = Token(SyntaxKind.ThisKeyword); 101public static readonly SyntaxToken TildeToken = Token(SyntaxKind.TildeToken); 102public static readonly SyntaxToken UIntKeyword = Token(SyntaxKind.UIntKeyword); 103public static readonly SyntaxToken ULongKeyword = Token(SyntaxKind.ULongKeyword); 104public static readonly SyntaxToken UnmanagedKeyword = Token(SyntaxKind.UnmanagedKeyword); 105public static readonly SyntaxToken UnsafeKeyword = Token(SyntaxKind.UnsafeKeyword); 106public static readonly SyntaxToken UShortKeyword = Token(SyntaxKind.UShortKeyword); 107public static readonly SyntaxToken UsingKeyword = Token(SyntaxKind.UsingKeyword); 108public static readonly SyntaxToken VirtualKeyword = Token(SyntaxKind.VirtualKeyword); 109public static readonly SyntaxToken VoidKeyword = Token(SyntaxKind.VoidKeyword); 110public static readonly SyntaxToken VolatileKeyword = Token(SyntaxKind.VolatileKeyword); 111public static readonly SyntaxToken WhereKeyword = Token(SyntaxKind.WhereKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\CSharpCodeStyleOptions.cs (19)
157private static readonly ImmutableArray<SyntaxKind> s_preferredModifierOrderDefault = 159SyntaxKind.PublicKeyword, 160SyntaxKind.PrivateKeyword, 161SyntaxKind.ProtectedKeyword, 162SyntaxKind.InternalKeyword, 163SyntaxKind.FileKeyword, 164SyntaxKind.StaticKeyword, 165SyntaxKind.ExternKeyword, 166SyntaxKind.NewKeyword, 167SyntaxKind.VirtualKeyword, 168SyntaxKind.AbstractKeyword, 170SyntaxKind.ClosedKeyword, 172SyntaxKind.SealedKeyword, 173SyntaxKind.OverrideKeyword, 174SyntaxKind.ReadOnlyKeyword, 175SyntaxKind.UnsafeKeyword, 176SyntaxKind.RequiredKeyword, 177SyntaxKind.VolatileKeyword, 178SyntaxKind.AsyncKeyword,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (7)
66if (initializerExpression.IsKind(SyntaxKind.DefaultExpression)) 79if (initializerExpression.Kind() is SyntaxKind.ObjectCreationExpression or SyntaxKind.ArrayCreationExpression && 80!initializerExpression.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 87if (initializerExpression.Kind() is SyntaxKind.CastExpression or SyntaxKind.IsExpression or SyntaxKind.AsExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (18)
35if (token.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 38if (token.Parent?.Parent is InterpolatedStringExpressionSyntax { StringStartToken.RawKind: (int)SyntaxKind.InterpolatedMultiLineRawStringStartToken }) 63case SyntaxKind.CharacterLiteralToken: 66case SyntaxKind.StringLiteralToken: 71case SyntaxKind.Utf8StringLiteralToken: 76case SyntaxKind.SingleLineRawStringLiteralToken: 77case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 80case SyntaxKind.MultiLineRawStringLiteralToken: 81case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 86case SyntaxKind.InterpolatedStringTextToken: 97SyntaxKind.InterpolatedStringStartToken => TryConvertStringToVirtualChars(token, "", "", escapeBraces: true), 98SyntaxKind.InterpolatedVerbatimStringStartToken => TryConvertVerbatimStringToVirtualChars(token, "", "", escapeBraces: true), 99SyntaxKind.InterpolatedSingleLineRawStringStartToken => TryConvertSingleLineRawStringToVirtualChars(token), 100SyntaxKind.InterpolatedMultiLineRawStringStartToken 138if (token.Kind() is SyntaxKind.Utf8SingleLineRawStringLiteralToken) 144if (token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (5)
27SyntaxKind.RefKeyword => RefKind.Ref, 28SyntaxKind.OutKeyword => RefKind.Out, 29SyntaxKind.InKeyword => RefKind.In, 81if (argument.RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword && 87if (argument.RefOrOutKeyword.Kind() == SyntaxKind.RefKeyword &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\AssignmentExpressionSyntaxExtensions.cs (4)
16return assignment.Kind() == SyntaxKind.SimpleAssignmentExpression && 17assignment.OperatorToken.Kind() == SyntaxKind.EqualsToken && 18(left.Kind() == SyntaxKind.TupleExpression || left.Kind() == SyntaxKind.DeclarationExpression);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (15)
27Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.IfDirectiveTrivia), nameof(IfDirectiveTriviaSyntax)), 29Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElifDirectiveTrivia), nameof(ElifDirectiveTriviaSyntax))), 30Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElseDirectiveTrivia), nameof(ElseDirectiveTriviaSyntax)), 31Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.EndIfDirectiveTrivia), nameof(EndIfDirectiveTriviaSyntax))); 78if (leadingDirectives.Any(t => t.Kind() == SyntaxKind.EndIfDirectiveTrivia)) 113if (nextTrivia.Kind() == SyntaxKind.DisabledTextTrivia) 137SyntaxKind declarationKind, 157if (parent.Kind() == SyntaxKind.GetAccessorDeclaration) 175private static bool IsSupportedInCSharp6(SyntaxKind declarationKind) 179case SyntaxKind.ConstructorDeclaration: 180case SyntaxKind.DestructorDeclaration: 181case SyntaxKind.AddAccessorDeclaration: 182case SyntaxKind.RemoveAccessorDeclaration: 183case SyntaxKind.GetAccessorDeclaration: 184case SyntaxKind.SetAccessorDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (2)
16SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression); 69if (equalsValueClause.IsParentKind(SyntaxKind.VariableDeclarator) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DirectiveSyntaxExtensions.cs (6)
63=> directive?.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia; 67is SyntaxKind.IfDirectiveTrivia 68or SyntaxKind.ElifDirectiveTrivia 69or SyntaxKind.ElseDirectiveTrivia 70or SyntaxKind.EndIfDirectiveTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (138)
38while (expression is PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfixExpression) 48=> expression?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == expression; 84return firstToken.Kind() != SyntaxKind.None 85&& firstToken.GetPreviousToken().Kind() == SyntaxKind.CloseParenToken; 98=> (expression?.Parent) is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && 109=> name.IsParentKind(SyntaxKind.ExplicitInterfaceSpecifier); 130if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess) 160if (!simpleName.IsKind(SyntaxKind.IdentifierName)) 187if (expression.IsParentKind(SyntaxKind.ConstantPattern)) 197=> expression?.Parent is ArgumentSyntax { RefOrOutKeyword: SyntaxToken(SyntaxKind.OutKeyword) } argument && 209while (expression?.Parent is ParenthesizedExpressionSyntax or PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression)) 213ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.RefKeyword }) 224=> expression?.Parent is ArgumentSyntax { RefKindKeyword: SyntaxToken(SyntaxKind.InKeyword) }; 275if (!expr.IsParentKind(SyntaxKind.Argument)) 290case SyntaxKind.Argument: 291if (parent.Parent?.Kind() == SyntaxKind.TupleExpression) 298case SyntaxKind.SimpleAssignmentExpression: 305case SyntaxKind.ForEachVariableStatement: 355if (expression.Parent.IsKind(SyntaxKind.AddressOfExpression)) 400return nameEquals.IsParentKind(SyntaxKind.AttributeArgument); 409case SyntaxKind.PostIncrementExpression: 410case SyntaxKind.PreIncrementExpression: 411case SyntaxKind.PostDecrementExpression: 412case SyntaxKind.PreDecrementExpression: 428name.Identifier.Text == SyntaxFacts.GetText(SyntaxKind.NameOfKeyword)) 467if (expression.IsKind(SyntaxKind.StackAllocArrayCreationExpression)) 476is SyntaxKind.BaseExpression 477or SyntaxKind.CollectionInitializerExpression 478or SyntaxKind.ObjectInitializerExpression 479or SyntaxKind.ComplexElementInitializerExpression) 485if (expression is LiteralExpressionSyntax && !expression.IsParentKind(SyntaxKind.UnaryMinusExpression)) 515if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 517return expression is { Parent.RawKind: not (int)SyntaxKind.ConditionalAccessExpression }; 525case SyntaxKind.InvocationExpression: 529if (expression.IsKind(SyntaxKind.IdentifierName) || expression is MemberAccessExpressionSyntax) 552case SyntaxKind.ConditionalAccessExpression: 555!parentConditionalAccessExpression.Parent.IsKind(SyntaxKind.ConditionalAccessExpression); 557case SyntaxKind.IsExpression: 558case SyntaxKind.AsExpression: 562case SyntaxKind.EqualsValueClause: 563case SyntaxKind.ExpressionStatement: 564case SyntaxKind.ArrayInitializerExpression: 565case SyntaxKind.CollectionInitializerExpression: 566case SyntaxKind.Argument: 567case SyntaxKind.AttributeArgument: 568case SyntaxKind.AnonymousObjectMemberDeclarator: 569case SyntaxKind.ArrowExpressionClause: 570case SyntaxKind.AwaitExpression: 571case SyntaxKind.ReturnStatement: 572case SyntaxKind.YieldReturnStatement: 573case SyntaxKind.ParenthesizedLambdaExpression: 574case SyntaxKind.SimpleLambdaExpression: 575case SyntaxKind.ParenthesizedExpression: 576case SyntaxKind.ArrayRankSpecifier: 577case SyntaxKind.ConditionalExpression: 578case SyntaxKind.IfStatement: 579case SyntaxKind.CatchFilterClause: 580case SyntaxKind.WhileStatement: 581case SyntaxKind.DoStatement: 582case SyntaxKind.ThrowStatement: 583case SyntaxKind.SwitchStatement: 584case SyntaxKind.InterpolatedStringExpression: 585case SyntaxKind.ComplexElementInitializerExpression: 586case SyntaxKind.Interpolation: 587case SyntaxKind.RefExpression: 588case SyntaxKind.LockStatement: 589case SyntaxKind.ElementAccessExpression: 590case SyntaxKind.SwitchExpressionArm: 591case SyntaxKind.WhenClause: 598if (!(expression is LiteralExpressionSyntax && expression.IsParentKind(SyntaxKind.UnaryMinusExpression))) 639if ((expression.IsParentKind(SyntaxKind.NameEquals) && expression.Parent.IsParentKind(SyntaxKind.AttributeArgument)) || 655identifierName.Identifier.IsKindOrHasMatchingText(SyntaxKind.NameOfKeyword); 697case SyntaxKind.SimpleMemberAccessExpression: 698case SyntaxKind.ConditionalAccessExpression: 699case SyntaxKind.InvocationExpression: 700case SyntaxKind.ElementAccessExpression: 701case SyntaxKind.PostIncrementExpression: 702case SyntaxKind.PostDecrementExpression: 703case SyntaxKind.ObjectCreationExpression: 704case SyntaxKind.ImplicitObjectCreationExpression: 705case SyntaxKind.TypeOfExpression: 706case SyntaxKind.DefaultExpression: 707case SyntaxKind.CheckedExpression: 708case SyntaxKind.UncheckedExpression: 709case SyntaxKind.AnonymousMethodExpression: 710case SyntaxKind.SuppressNullableWarningExpression: 712case SyntaxKind.SizeOfExpression: 713case SyntaxKind.PointerMemberAccessExpression: 719case SyntaxKind.UnaryPlusExpression: 720case SyntaxKind.UnaryMinusExpression: 721case SyntaxKind.LogicalNotExpression: 722case SyntaxKind.BitwiseNotExpression: 723case SyntaxKind.PreIncrementExpression: 724case SyntaxKind.PreDecrementExpression: 725case SyntaxKind.CastExpression: 726case SyntaxKind.AwaitExpression: 728case SyntaxKind.PointerIndirectionExpression: 729case SyntaxKind.AddressOfExpression: 736case SyntaxKind.RangeExpression: 742case SyntaxKind.MultiplyExpression: 743case SyntaxKind.DivideExpression: 744case SyntaxKind.ModuloExpression: 750case SyntaxKind.AddExpression: 751case SyntaxKind.SubtractExpression: 757case SyntaxKind.LeftShiftExpression: 758case SyntaxKind.RightShiftExpression: 764case SyntaxKind.LessThanExpression: 765case SyntaxKind.GreaterThanExpression: 766case SyntaxKind.LessThanOrEqualExpression: 767case SyntaxKind.GreaterThanOrEqualExpression: 768case SyntaxKind.IsExpression: 769case SyntaxKind.AsExpression: 770case SyntaxKind.IsPatternExpression: 776case SyntaxKind.EqualsExpression: 777case SyntaxKind.NotEqualsExpression: 783case SyntaxKind.BitwiseAndExpression: 789case SyntaxKind.ExclusiveOrExpression: 795case SyntaxKind.BitwiseOrExpression: 801case SyntaxKind.LogicalAndExpression: 807case SyntaxKind.LogicalOrExpression: 813case SyntaxKind.CoalesceExpression: 819case SyntaxKind.ConditionalExpression: 825case SyntaxKind.SimpleAssignmentExpression: 826case SyntaxKind.MultiplyAssignmentExpression: 827case SyntaxKind.DivideAssignmentExpression: 828case SyntaxKind.ModuloAssignmentExpression: 829case SyntaxKind.AddAssignmentExpression: 830case SyntaxKind.SubtractAssignmentExpression: 831case SyntaxKind.LeftShiftAssignmentExpression: 832case SyntaxKind.RightShiftAssignmentExpression: 833case SyntaxKind.AndAssignmentExpression: 834case SyntaxKind.ExclusiveOrAssignmentExpression: 835case SyntaxKind.OrAssignmentExpression: 836case SyntaxKind.SimpleLambdaExpression: 837case SyntaxKind.ParenthesizedLambdaExpression: 843case SyntaxKind.SwitchExpression: 1091return binaryExpression.Kind() == SyntaxKind.CoalesceExpression && binaryExpression.Right == expression && HasType(binaryExpression.Left, out var leftType) ? leftType : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (2)
17.FirstOrDefault(node => node.Kind() is SyntaxKind.LocalFunctionStatement or SyntaxKind.MethodDeclaration);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (50)
32case SyntaxKind.EnumDeclaration: 34case SyntaxKind.ClassDeclaration: 36case SyntaxKind.ExtensionBlockDeclaration: 37case SyntaxKind.UnionDeclaration: 39case SyntaxKind.InterfaceDeclaration: 40case SyntaxKind.RecordDeclaration: 41case SyntaxKind.RecordStructDeclaration: 42case SyntaxKind.StructDeclaration: 44case SyntaxKind.DelegateDeclaration: 46case SyntaxKind.FieldDeclaration: 48case SyntaxKind.EventFieldDeclaration: 50case SyntaxKind.PropertyDeclaration: 52case SyntaxKind.EventDeclaration: 54case SyntaxKind.MethodDeclaration: 56case SyntaxKind.ConstructorDeclaration: 58case SyntaxKind.DestructorDeclaration: 60case SyntaxKind.IndexerDeclaration: 62case SyntaxKind.OperatorDeclaration: 77case SyntaxKind.ClassDeclaration: 79case SyntaxKind.ExtensionBlockDeclaration: 80case SyntaxKind.UnionDeclaration: 82case SyntaxKind.InterfaceDeclaration: 83case SyntaxKind.RecordDeclaration: 84case SyntaxKind.RecordStructDeclaration: 85case SyntaxKind.StructDeclaration: 87case SyntaxKind.DelegateDeclaration: 89case SyntaxKind.MethodDeclaration: 105case SyntaxKind.ClassDeclaration: 107case SyntaxKind.ExtensionBlockDeclaration: 108case SyntaxKind.UnionDeclaration: 110case SyntaxKind.InterfaceDeclaration: 111case SyntaxKind.RecordDeclaration: 112case SyntaxKind.RecordStructDeclaration: 113case SyntaxKind.StructDeclaration: 115case SyntaxKind.DelegateDeclaration: 117case SyntaxKind.MethodDeclaration: 135case SyntaxKind.DelegateDeclaration: 137case SyntaxKind.MethodDeclaration: 139case SyntaxKind.ConstructorDeclaration: 141case SyntaxKind.IndexerDeclaration: 143case SyntaxKind.OperatorDeclaration: 145case SyntaxKind.ConversionOperatorDeclaration: 159case SyntaxKind.DelegateDeclaration: 161case SyntaxKind.MethodDeclaration: 163case SyntaxKind.OperatorDeclaration: 165case SyntaxKind.PropertyDeclaration: 167case SyntaxKind.IndexerDeclaration: 169case SyntaxKind.EventDeclaration: 171case SyntaxKind.EventFieldDeclaration: 173case SyntaxKind.FieldDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.DeclarationFinder.cs (1)
32if (syntaxToken.Kind() == SyntaxKind.IdentifierToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (75)
38var parentExpression = nodeParent.IsKind(SyntaxKind.ConstantPattern) 57if (expression.IsKind(SyntaxKind.ParenthesizedExpression) || 58parentExpression.IsKind(SyntaxKind.ParenthesizedExpression)) 84if (expression.Kind() is SyntaxKind.GreaterThanExpression or SyntaxKind.LessThanExpression && 87var opposite = expression.IsKind(SyntaxKind.GreaterThanExpression) ? SyntaxKind.LessThanExpression : SyntaxKind.GreaterThanExpression; 93if (expression.IsKind(SyntaxKind.ThrowExpression)) 97if (nodeParent.IsKind(SyntaxKind.ExpressionStatement)) 101if (nodeParent.IsKind(SyntaxKind.ArrowExpressionClause)) 105if (nodeParent.Kind() is SyntaxKind.CheckedExpression or SyntaxKind.UncheckedExpression) 109if (expression.IsKind(SyntaxKind.TupleExpression)) 117if (tokenAfterParen.Kind() == SyntaxKind.OpenBracketToken) 170(nodeParent is YieldStatementSyntax(SyntaxKind.YieldReturnStatement) yieldStatement && yieldStatement.Expression == node) || 195if (nodeParent.IsKind(SyntaxKind.CastExpression) && expression.IsKind(SyntaxKind.ThisExpression)) 205if (nodeParent.IsKind(SyntaxKind.Interpolation)) 210if (expression.IsKind(SyntaxKind.InterpolatedStringExpression)) 257if (expression.IsKind(SyntaxKind.ThisExpression)) 271if (expression.IsKind(SyntaxKind.ThrowExpression) && 272nodeParent is BinaryExpressionSyntax(SyntaxKind.CoalesceExpression) binary && 279if (nodeParent.IsKind(SyntaxKind.CaseSwitchLabel)) 283if (nodeParent.IsKind(SyntaxKind.ConstantPattern) && 284nodeParent.IsParentKind(SyntaxKind.CasePatternSwitchLabel)) 290if (nodeParent.IsKind(SyntaxKind.WhenClause)) 318if (parentExpression.IsKind(SyntaxKind.CastExpression) && 319expression.Kind() is SyntaxKind.PreIncrementExpression or SyntaxKind.PreDecrementExpression) 326if (expression.IsKind(SyntaxKind.ConditionalExpression) && 337if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 389if (ancestor.IsKind(SyntaxKind.ParenthesizedExpression)) 392if (ancestor.IsKind(SyntaxKind.Interpolation, out interpolation)) 414if (!childNode.IsKind(SyntaxKind.ParenthesizedExpression)) 419if (nodeOrToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.ColonColonToken) 488if (parentExpression.IsKind(SyntaxKind.CoalesceExpression)) 510private static bool IsAssociative(SyntaxKind kind) 514case SyntaxKind.AddExpression: 515case SyntaxKind.MultiplyExpression: 516case SyntaxKind.BitwiseOrExpression: 517case SyntaxKind.ExclusiveOrExpression: 518case SyntaxKind.LogicalOrExpression: 519case SyntaxKind.BitwiseAndExpression: 520case SyntaxKind.LogicalAndExpression: 551SyntaxKind.PredefinedType or 552SyntaxKind.ArrayType or 553SyntaxKind.PointerType or 554SyntaxKind.NullableType) 567SyntaxKind.UnaryMinusExpression or 568SyntaxKind.UnaryPlusExpression or 569SyntaxKind.PointerIndirectionExpression or 570SyntaxKind.AddressOfExpression) 581if (name.IsKind(SyntaxKind.AliasQualifiedName)) 607binaryExpression.Kind() is SyntaxKind.LessThanExpression or SyntaxKind.GreaterThanExpression && 608(binaryExpression.IsParentKind(SyntaxKind.Argument) || binaryExpression.Parent is InitializerExpressionSyntax)) 610if (binaryExpression.IsKind(SyntaxKind.LessThanExpression)) 623else if (binaryExpression.IsKind(SyntaxKind.GreaterThanExpression)) 626binaryExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression) 638else if (node.Expression.IsKind(SyntaxKind.LessThanExpression)) 645else if (node.Expression.IsKind(SyntaxKind.GreaterThanExpression)) 681previousExpression is not BinaryExpressionSyntax(SyntaxKind.LessThanExpression) lessThanExpression) 687|| lessThanExpression.Left.IsKind(SyntaxKind.CastExpression)) 716nextExpression is not BinaryExpressionSyntax(SyntaxKind.GreaterThanExpression) greaterThanExpression) 722&& greaterThanExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression; 726=> expression.Kind() is SyntaxKind.IdentifierName or SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression; 818if (binaryPattern.IsKind(SyntaxKind.AndPattern)) 821if (binaryPattern.IsKind(SyntaxKind.OrPattern))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (31)
63case SyntaxKind.SimpleMemberAccessExpression: 64case SyntaxKind.PointerMemberAccessExpression: 70case SyntaxKind.QualifiedName: 76case SyntaxKind.AliasQualifiedName: 82case SyntaxKind.GenericName: 88case SyntaxKind.IdentifierName: 153case SyntaxKind.CommaToken: 154case SyntaxKind.DelegateKeyword: 225variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 232if (type.IsParentKind(SyntaxKind.ObjectCreationExpression) && 233type.Parent.IsParentKind(SyntaxKind.EqualsValueClause) && 234type.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclarator) && 235type.Parent.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 236variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 252is SyntaxKind.DelegateDeclaration 253or SyntaxKind.MethodDeclaration 254or SyntaxKind.PropertyDeclaration 255or SyntaxKind.EventDeclaration 256or SyntaxKind.IndexerDeclaration 257or SyntaxKind.OperatorDeclaration) 273if (type.IsParentKind(SyntaxKind.Parameter) && type.Parent.IsParentKind(SyntaxKind.ParameterList)) 276is SyntaxKind.DelegateDeclaration 277or SyntaxKind.MethodDeclaration 278or SyntaxKind.IndexerDeclaration 279or SyntaxKind.OperatorDeclaration) 285if (type.Parent.Parent.IsParentKind(SyntaxKind.ConstructorDeclaration)) 296if (type.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 297variableDeclaration.IsParentKind(SyntaxKind.EventFieldDeclaration)) 307if (type.IsParentKind(SyntaxKind.TypeConstraint)) 447if (SyntaxFacts.GetContextualKeywordKind(parameter.Name) is not SyntaxKind.UnderscoreToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SimpleNameSyntaxExtensions.cs (1)
16Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.IsParentKind(SyntaxKind.NameMemberCref));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (2)
40if (first.Parent.IsKind(SyntaxKind.GlobalStatement)) 41return second.Parent.IsKind(SyntaxKind.GlobalStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SymbolDisplayPartExtensions.cs (1)
21if (SyntaxFacts.GetKeywordKind(text) != SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxKindExtensions.cs (29)
14/// Determine if the given <see cref="SyntaxKind"/> array contains the given kind. 22public static bool Contains(this SyntaxKind[] kinds, SyntaxKind kind) 24foreach (var k in kinds) 35public static SyntaxKind MapCompoundAssignmentKindToBinaryExpressionKind(this SyntaxKind syntaxKind) 39case SyntaxKind.AddAssignmentExpression: 40return SyntaxKind.AddExpression; 42case SyntaxKind.SubtractAssignmentExpression: 43return SyntaxKind.SubtractExpression; 45case SyntaxKind.MultiplyAssignmentExpression: 46return SyntaxKind.MultiplyExpression; 48case SyntaxKind.DivideAssignmentExpression: 49return SyntaxKind.DivideExpression; 51case SyntaxKind.ModuloAssignmentExpression: 52return SyntaxKind.ModuloExpression; 54case SyntaxKind.AndAssignmentExpression: 55return SyntaxKind.BitwiseAndExpression; 57case SyntaxKind.ExclusiveOrAssignmentExpression: 58return SyntaxKind.ExclusiveOrExpression; 60case SyntaxKind.OrAssignmentExpression: 61return SyntaxKind.BitwiseOrExpression; 63case SyntaxKind.LeftShiftAssignmentExpression: 64return SyntaxKind.LeftShiftExpression; 66case SyntaxKind.RightShiftAssignmentExpression: 67return SyntaxKind.RightShiftExpression; 69case SyntaxKind.CoalesceAssignmentExpression: 70return SyntaxKind.CoalesceExpression; 74return SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (57)
28public static void Deconstruct(this SyntaxNode node, out SyntaxKind kind) 31public static bool IsKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 44public static bool IsParentKind([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind) 47public static bool IsParentKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 75if (prevToken.Kind() == SyntaxKind.None) 93is SyntaxKind.ArgumentList 94or SyntaxKind.AttributeArgumentList 95or SyntaxKind.BracketedArgumentList 96or SyntaxKind.TypeArgumentList; 186if ((current?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == current) || 196SyntaxKind.InvocationExpression or 197SyntaxKind.ElementAccessExpression or 198SyntaxKind.SimpleMemberAccessExpression or 199SyntaxKind.MemberBindingExpression or 200SyntaxKind.ElementBindingExpression or 202SyntaxKind.SuppressNullableWarningExpression) && 285=> node is AssignmentExpressionSyntax(kind: not SyntaxKind.SimpleAssignmentExpression); 288=> node?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment && 332m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword)); 345case LocalFunctionStatementSyntax localFunction when localFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 348case AnonymousFunctionExpressionSyntax anonymousFunction when anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 352return current.GetModifiers().Any(SyntaxKind.StaticKeyword); 355return property.Modifiers.Any(SyntaxKind.StaticKeyword) || 360return !current.Parent.IsKind(SyntaxKind.CompilationUnit); 399case SyntaxKind.DoStatement: 400case SyntaxKind.WhileStatement: 401case SyntaxKind.SwitchStatement: 402case SyntaxKind.ForStatement: 403case SyntaxKind.ForEachStatement: 404case SyntaxKind.ForEachVariableStatement: 415case SyntaxKind.DoStatement: 416case SyntaxKind.WhileStatement: 417case SyntaxKind.ForStatement: 418case SyntaxKind.ForEachStatement: 419case SyntaxKind.ForEachVariableStatement: 430case SyntaxKind.AnonymousMethodExpression: 431case SyntaxKind.SimpleLambdaExpression: 432case SyntaxKind.ParenthesizedLambdaExpression: 433case SyntaxKind.LocalFunctionStatement: 434case SyntaxKind.MethodDeclaration: 435case SyntaxKind.ConstructorDeclaration: 436case SyntaxKind.DestructorDeclaration: 437case SyntaxKind.GetAccessorDeclaration: 438case SyntaxKind.SetAccessorDeclaration: 439case SyntaxKind.InitAccessorDeclaration: 440case SyntaxKind.OperatorDeclaration: 441case SyntaxKind.ConversionOperatorDeclaration: 442case SyntaxKind.AddAccessorDeclaration: 443case SyntaxKind.RemoveAccessorDeclaration: 454=> node.IsReturnableConstruct() || (node is CompilationUnitSyntax compilationUnit && compilationUnit.Members.Any(SyntaxKind.GlobalStatement)); 556if (trivia.GetStructure() is (kind: SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia or SyntaxKind.IfDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia)) 570else if (trivia.GetStructure() is (kind: SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia)) 898while (finalTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)])
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
60if (token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (88)
20public static void Deconstruct(this SyntaxToken token, out SyntaxKind kind) 39public static bool IsKindOrHasMatchingText(this SyntaxToken token, SyntaxKind kind) 42public static bool HasMatchingText(this SyntaxToken token, SyntaxKind kind) 46=> token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 47token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression); 50=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList); 64if (token.Kind() == SyntaxKind.IdentifierToken) 69SyntaxFacts.GetContextualKeywordKind(simpleNameText) != SyntaxKind.None; 75public static bool IsPotentialModifier(this SyntaxToken token, out SyntaxKind modifierKind) 77var tokenKind = token.Kind(); 78modifierKind = SyntaxKind.None; 82case SyntaxKind.PublicKeyword: 83case SyntaxKind.InternalKeyword: 84case SyntaxKind.ProtectedKeyword: 85case SyntaxKind.PrivateKeyword: 86case SyntaxKind.SealedKeyword: 87case SyntaxKind.AbstractKeyword: 89case SyntaxKind.ClosedKeyword: 91case SyntaxKind.StaticKeyword: 92case SyntaxKind.VirtualKeyword: 93case SyntaxKind.ExternKeyword: 94case SyntaxKind.NewKeyword: 95case SyntaxKind.OverrideKeyword: 96case SyntaxKind.ReadOnlyKeyword: 97case SyntaxKind.VolatileKeyword: 98case SyntaxKind.UnsafeKeyword: 99case SyntaxKind.AsyncKeyword: 100case SyntaxKind.RefKeyword: 101case SyntaxKind.OutKeyword: 102case SyntaxKind.InKeyword: 103case SyntaxKind.RequiredKeyword: 104case SyntaxKind.FileKeyword: 105case SyntaxKind.PartialKeyword: 108case SyntaxKind.IdentifierToken: 109if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 111modifierKind = SyntaxKind.AsyncKeyword; 113if (token.HasMatchingText(SyntaxKind.FileKeyword)) 115modifierKind = SyntaxKind.FileKeyword; 118if (token.HasMatchingText(SyntaxKind.ClosedKeyword)) 120modifierKind = SyntaxKind.ClosedKeyword; 123if (token.HasMatchingText(SyntaxKind.PartialKeyword)) 125modifierKind = SyntaxKind.PartialKeyword; 127return modifierKind != SyntaxKind.None; 137case SyntaxKind.CharacterLiteralToken: 138case SyntaxKind.FalseKeyword: 139case SyntaxKind.NumericLiteralToken: 140case SyntaxKind.StringLiteralToken: 141case SyntaxKind.TrueKeyword: 171if (previousToken.Kind() == SyntaxKind.None) 204=> token.Kind() == SyntaxKind.StringLiteralToken && !token.IsVerbatimStringLiteral(); 210case SyntaxKind.AssemblyKeyword: 211case SyntaxKind.ModuleKeyword: 212case SyntaxKind.FieldKeyword: 213case SyntaxKind.EventKeyword: 214case SyntaxKind.MethodKeyword: 215case SyntaxKind.ParamKeyword: 216case SyntaxKind.PropertyKeyword: 217case SyntaxKind.ReturnKeyword: 218case SyntaxKind.TypeKeyword: 242if (genericIdentifier.GetNextToken(includeSkipped: true).Kind() == SyntaxKind.LessThanToken) 266Contract.ThrowIfFalse(genericIdentifier.Kind() == SyntaxKind.IdentifierToken); 270Contract.ThrowIfFalse(token.Kind() == SyntaxKind.LessThanToken); 279if (next.Kind() == SyntaxKind.None) 287if (token.Kind() == SyntaxKind.GreaterThanToken) 302case SyntaxKind.LessThanLessThanToken: 304goto case SyntaxKind.LessThanToken; 307case SyntaxKind.LessThanToken: 311case SyntaxKind.AsteriskToken: // for int* 312case SyntaxKind.QuestionToken: // for int? 313case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 314case SyntaxKind.ColonColonToken: // for global:: 315case SyntaxKind.CloseBracketToken: 316case SyntaxKind.OpenBracketToken: 317case SyntaxKind.DotToken: 318case SyntaxKind.IdentifierToken: 319case SyntaxKind.CommaToken: 323case SyntaxKind.ClassKeyword: 324case SyntaxKind.StructKeyword: 325case SyntaxKind.InterfaceKeyword: 326case SyntaxKind.DelegateKeyword: 327case SyntaxKind.EnumKeyword: 328case SyntaxKind.PrivateKeyword: 329case SyntaxKind.PublicKeyword: 330case SyntaxKind.InternalKeyword: 331case SyntaxKind.ProtectedKeyword: 332case SyntaxKind.VoidKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (54)
17public static ISet<SyntaxKind> GetPrecedingModifiers(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 20public static ISet<SyntaxKind> GetPrecedingModifiers( 30var result = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer); 31while (token.IsPotentialModifier(out var modifierKind)) 87private static readonly Func<SyntaxKind, bool> s_isDot = k => k is SyntaxKind.DotToken; 88private static readonly Func<SyntaxKind, bool> s_isDotOrArrow = k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken; 89private static readonly Func<SyntaxKind, bool> s_isDotOrArrowOrColonColon = 90k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken or SyntaxKind.ColonColonToken; 95(targetToken.IsKind(SyntaxKind.DotDotToken) && position == targetToken.SpanStart + 1) || 106this SyntaxTree syntaxTree, int position, Func<SyntaxKind, bool> predicate, CancellationToken cancellationToken) 111if (token.Kind() == SyntaxKind.None) 122return token.Kind() == SyntaxKind.NumericLiteralToken; 125public static bool IsAfterKeyword(this SyntaxTree syntaxTree, int position, SyntaxKind kind, CancellationToken cancellationToken) 202var endsWithNewLine = trivia.GetStructure()!.GetLastToken(includeSkipped: true).Kind() == SyntaxKind.XmlTextLiteralNewLineToken; 263if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 269return trivia.Kind() == SyntaxKind.ConflictMarkerTrivia; 277if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 303if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 324var kind = token.Kind(); 326SyntaxKind.StringLiteralToken or 327SyntaxKind.CharacterLiteralToken or 328SyntaxKind.SingleLineRawStringLiteralToken or 329SyntaxKind.MultiLineRawStringLiteralToken or 330SyntaxKind.Utf8StringLiteralToken or 331SyntaxKind.Utf8SingleLineRawStringLiteralToken or 332SyntaxKind.Utf8MultiLineRawStringLiteralToken)) 339SyntaxKind.Utf8StringLiteralToken or 340SyntaxKind.Utf8SingleLineRawStringLiteralToken or 341SyntaxKind.Utf8MultiLineRawStringLiteralToken) 349if (kind is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken) 399if (token.Kind() is SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken) 404SyntaxKind.StringLiteralToken or 405SyntaxKind.SingleLineRawStringLiteralToken or 406SyntaxKind.MultiLineRawStringLiteralToken or 407SyntaxKind.Utf8StringLiteralToken or 408SyntaxKind.Utf8SingleLineRawStringLiteralToken or 409SyntaxKind.Utf8MultiLineRawStringLiteralToken) 421SyntaxKind.InterpolatedStringStartToken or 422SyntaxKind.InterpolatedStringEndToken or 423SyntaxKind.InterpolatedRawStringEndToken or 424SyntaxKind.InterpolatedSingleLineRawStringStartToken or 425SyntaxKind.InterpolatedMultiLineRawStringStartToken) 430if (token.Kind() is SyntaxKind.InterpolatedStringTextToken) 455if (token.Kind() == SyntaxKind.CharacterLiteralToken) 497if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 503if (token.Kind() == SyntaxKind.EndOfFileToken) 553if (token.IsKind(SyntaxKind.HashToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (15)
21public static void Deconstruct(this SyntaxTrivia trivia, out SyntaxKind kind) 25=> trivia.Kind() is SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineCommentTrivia; 37=> trivia.Kind() == SyntaxKind.SingleLineCommentTrivia; 40=> trivia.Kind() == SyntaxKind.MultiLineCommentTrivia; 43=> trivia.Kind() == SyntaxKind.ShebangDirectiveTrivia; 47if (trivia.Kind() != SyntaxKind.MultiLineCommentTrivia) 58=> trivia.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia; 61=> trivia.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia; 66if (trivia.Kind() == SyntaxKind.SingleLineCommentTrivia) 75else if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 148=> trivia.Kind() == SyntaxKind.EndOfLineTrivia; 151=> trivia.Kind() == SyntaxKind.WhitespaceTrivia; 203if (trivia.IsKind(SyntaxKind.PragmaWarningDirectiveTrivia)) 206isDisable = pragmaWarning.DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (8)
21.Where(t => t.Kind() == SyntaxKind.EndOfLineTrivia) 38.Where(t => t is (kind: SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.WhitespaceTrivia)) 43=> triviaList.SkipWhile(t => t.Kind() == SyntaxKind.WhitespaceTrivia); 52if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 55t.Kind() is SyntaxKind.EndOfLineTrivia or 56SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
15predefinedType.Keyword.IsKind(SyntaxKind.VoidKeyword); 20((IdentifierNameSyntax)typeSyntax).Identifier.IsKind(SyntaxKind.PartialKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\DefaultOperationProvider.cs (1)
45var space = currentToken.Kind() == SyntaxKind.EndOfFileToken ? 0 : 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (16)
37=> trivia.RawKind == (int)SyntaxKind.WhitespaceTrivia; 40=> trivia.RawKind == (int)SyntaxKind.EndOfLineTrivia; 69if (trivia2.IsKind(SyntaxKind.None)) 90if (trivia2.IsKind(SyntaxKind.BadDirectiveTrivia) && existingWhitespaceBetween.Lines == 0 && !implicitLineBreak) 97var lines = (trivia1.IsKind(SyntaxKind.None) && this.Token1.IsKind(SyntaxKind.None)) ? 0 : 1; 99if (trivia2.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia) 110if (previous.IsKind(SyntaxKind.DisabledTextTrivia)) 114else if (previous.IsKind(SyntaxKind.EndIfDirectiveTrivia)) 178if (trivia2.IsKind(SyntaxKind.SkippedTokensTrivia)) 198structuredTrivia.GetTrailingTrivia().Any(SyntaxKind.EndOfLineTrivia); 210var isAtEndOfFileToken = (Token2.IsKind(SyntaxKind.EndOfFileToken) && trivia2.Kind() == 0); 220if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 334if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 363if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (3)
34if (trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia) 71if (currentParent.Kind() is SyntaxKind.SingleLineDocumentationCommentTrivia or 72SyntaxKind.MultiLineDocumentationCommentTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (9)
66for (var currentToken = token1; !currentToken.IsKind(SyntaxKind.None);) 76if (previousToken.TrailingTrivia is [.., (kind: SyntaxKind.EndOfLineTrivia)]) 101if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 105else if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 113else if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 117else if (trivia.Kind() is SyntaxKind.DisabledTextTrivia or 118SyntaxKind.PreprocessingMessageTrivia) 122else if (trivia.Kind() == SyntaxKind.ConflictMarkerTrivia) 155Debug.Assert(trivia.Kind() == SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (18)
36Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.EndOfLineTrivia); 37Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.SkippedTokensTrivia); 38Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia); 46if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 63if (trivia.Kind() == SyntaxKind.RegionDirectiveTrivia || 64trivia.Kind() == SyntaxKind.EndRegionDirectiveTrivia || 78if (trivia.Kind() is SyntaxKind.SkippedTokensTrivia or 79SyntaxKind.PreprocessingMessageTrivia) 125if (trivia.Kind() != SyntaxKind.WhitespaceTrivia) 154if (trivia.Kind() != SyntaxKind.EndOfLineTrivia) 213if (trivia.Kind() is not SyntaxKind.SkippedTokensTrivia and 214not SyntaxKind.PreprocessingMessageTrivia) 224if (trivia.Kind() is not SyntaxKind.RegionDirectiveTrivia and 225not SyntaxKind.EndRegionDirectiveTrivia) 269trivia.Kind() == SyntaxKind.WhitespaceTrivia || 270trivia.Kind() == SyntaxKind.EndOfLineTrivia) 309if (trivia.IsKind(SyntaxKind.DisabledTextTrivia)) 332if (xmlTrivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (2)
53var formatSpanEnd = commonToken2.Kind() == SyntaxKind.None ? commonToken1.Span.End : commonToken2.Span.Start; 81var firstTriviaInTree = this.Token1.Kind() == SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (1)
119if (trivia.Kind() == SyntaxKind.EndOfLineTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (95)
57if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.None) || 59bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.None)) 64if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBraceToken)) 66return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBraceToken); 69if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBracketToken)) 71return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBracketToken); 78=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.ConversionOperatorDeclaration); 81=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.OperatorDeclaration); 84=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 87=> token.Kind() == SyntaxKind.CloseParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 91return token.Kind() == SyntaxKind.OpenParenToken && 97return token.Kind() == SyntaxKind.CloseParenToken && 104if (token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList)) 110if (token.Parent.IsKind(SyntaxKind.PositionalPatternClause) && token.Parent.Parent.IsKind(SyntaxKind.RecursivePattern)) 120=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.BaseList); 123=> token.Kind() == SyntaxKind.CommaToken && (token.Parent.IsAnyArgumentList() || token.Parent?.Kind() is SyntaxKind.ParameterList or SyntaxKind.FunctionPointerParameterList); 126=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList) && token.Parent.Parent.IsKind(SyntaxKind.ParenthesizedLambdaExpression); 130if (node.Kind() != SyntaxKind.Block) 135return node.Parent?.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression; 140if (node.Kind() != SyntaxKind.Block) 145return node.IsParentKind(SyntaxKind.AnonymousMethodExpression); 151token.Kind() == SyntaxKind.SemicolonToken && 158if (token.Kind() != SyntaxKind.SemicolonToken) 174if (token.Kind() != SyntaxKind.CloseBraceToken) 179return token.Parent is ExpressionSyntax || token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 184if (token.Kind() != SyntaxKind.CloseBraceToken) 210return token.Kind() == SyntaxKind.CommaToken && 211token.Parent.IsKind(SyntaxKind.EnumDeclaration); 216return token.Kind() == SyntaxKind.CommaToken && 222return token.Kind() == SyntaxKind.CommaToken && 223token.Parent.IsKind(SyntaxKind.VariableDeclaration); 237case SyntaxKind.SizeOfExpression: 241case SyntaxKind.TypeOfExpression: 245case SyntaxKind.CheckedExpression: 246case SyntaxKind.UncheckedExpression: 250case SyntaxKind.DefaultExpression: 254case SyntaxKind.MakeRefExpression: 258case SyntaxKind.RefTypeExpression: 262case SyntaxKind.RefValueExpression: 266case SyntaxKind.ArgumentList: 270case SyntaxKind.AttributeArgumentList: 280return token.IsKind(SyntaxKind.EqualsToken) && 281token.Parent.IsKind(SyntaxKind.EqualsValueClause) && 282token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration); 308=> token.IsDotInMemberAccess() || (token.Kind() == SyntaxKind.DotToken && token.Parent.IsKind(SyntaxKind.QualifiedName)); 317return token.Kind() == SyntaxKind.DotToken 323if (token.Kind() == SyntaxKind.GreaterThanToken) 324return token.Parent is (kind: SyntaxKind.TypeParameterList or SyntaxKind.TypeArgumentList); 331return token.Kind() == SyntaxKind.CommaToken && 337=> token.Kind() == SyntaxKind.ColonToken && token.Parent is CasePatternSwitchLabelSyntax; 340=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.SwitchExpressionArm); 343=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.SwitchExpression); 346=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 350return token.Kind() == SyntaxKind.IdentifierToken && 360return token.Kind() == SyntaxKind.ColonToken && 377=> token.Kind() == SyntaxKind.InKeyword && token.Parent is FromClauseSyntax { Expression: QueryExpressionSyntax }; 381return token.Kind() == SyntaxKind.FromKeyword && 404if (expression.Kind() == SyntaxKind.SimpleAssignmentExpression) 432parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 451parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 466return (token1.Kind() == SyntaxKind.OpenParenToken && token2.Kind() == SyntaxKind.CloseParenToken) || 467(token1.Kind() == SyntaxKind.OpenBracketToken && token2.Kind() == SyntaxKind.CloseBracketToken); 472if (token.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 511if (token.Kind() is not SyntaxKind.PlusToken and not SyntaxKind.MinusToken) 520=> currentToken.Parent.IsKind(SyntaxKind.Interpolation); 527return currentToken.Kind() == SyntaxKind.OpenParenToken && currentToken is { Parent: ParenthesizedVariableDesignationSyntax, Parent.Parent: DeclarationExpressionSyntax }; 535return currentToken.IsKind(SyntaxKind.CommaToken) && 536currentToken.Parent.IsKind(SyntaxKind.TupleExpression); 541return currentToken.IsKind(SyntaxKind.CommaToken) && 542currentToken.Parent.IsKind(SyntaxKind.TupleType); 547return currentToken.IsKind(SyntaxKind.CommaToken) && 548currentToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation); 552=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.CollectionExpression); 559return !previousToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) && !currentToken.LeadingTrivia.Any(SyntaxKind.EndOfLineTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (3)
20if (node.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression) 26if (node.IsKind(SyntaxKind.AnonymousMethodExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (15)
24if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 37if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 51if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 65if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 80if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 116if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 126if (anchorToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 172else if (node.IsKind(SyntaxKind.PropertyPatternClause))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (62)
115currentToken.IsKind(SyntaxKind.WhereKeyword) && 116currentToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 130firstTokenAfterTypeConstraint.IsKind(SyntaxKind.WhereKeyword) && 131firstTokenAfterTypeConstraint.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 142currentToken.IsKind(SyntaxKind.OpenBraceToken) && 143currentToken.Parent.IsParentKind(SyntaxKind.IfStatement)) 176if (previousToken.Kind() != SyntaxKind.SemicolonToken) 179if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 182if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 216if (previousMember.Kind() is SyntaxKind.FieldDeclaration or 217SyntaxKind.EventFieldDeclaration) 293if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 310if (currentToken.Kind() == SyntaxKind.None) 317case SyntaxKind.None: 320case SyntaxKind.OpenBraceToken: 321case SyntaxKind.FinallyKeyword: 324case SyntaxKind.CloseBraceToken: 327case SyntaxKind.CloseParenToken: 329|| currentToken.Kind() == SyntaxKind.OpenBraceToken) ? 1 : 0; 331case SyntaxKind.CloseBracketToken: 337(parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.AssemblyKeyword) || 338parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.ModuleKeyword))) 340if (!currentToken.IsKind(SyntaxKind.EndOfFileToken) && !(currentToken.Parent is AttributeListSyntax)) 355case SyntaxKind.SemicolonToken: 358case SyntaxKind.CommaToken: 361case SyntaxKind.ElseKeyword: 362return currentToken.Kind() != SyntaxKind.IfKeyword ? 1 : 0; 364case SyntaxKind.ColonToken: 373if ((currentToken.Kind() == SyntaxKind.FromKeyword && currentToken.Parent.IsKind(SyntaxKind.FromClause)) || 374(currentToken.Kind() == SyntaxKind.LetKeyword && currentToken.Parent.IsKind(SyntaxKind.LetClause)) || 375(currentToken.Kind() == SyntaxKind.WhereKeyword && currentToken.Parent.IsKind(SyntaxKind.WhereClause)) || 376(currentToken.Kind() == SyntaxKind.JoinKeyword && currentToken.Parent.IsKind(SyntaxKind.JoinClause)) || 377(currentToken.Kind() == SyntaxKind.JoinKeyword && currentToken.Parent.IsKind(SyntaxKind.JoinIntoClause)) || 378(currentToken.Kind() == SyntaxKind.OrderByKeyword && currentToken.Parent.IsKind(SyntaxKind.OrderByClause)) || 379(currentToken.Kind() == SyntaxKind.SelectKeyword && currentToken.Parent.IsKind(SyntaxKind.SelectClause)) || 380(currentToken.Kind() == SyntaxKind.GroupKeyword && currentToken.Parent.IsKind(SyntaxKind.GroupClause))) 387case SyntaxKind.OpenBraceToken: 388case SyntaxKind.CloseBraceToken: 389case SyntaxKind.ElseKeyword: 390case SyntaxKind.FinallyKeyword: 393case SyntaxKind.OpenBracketToken: 399parent.Target.Identifier.Kind() is SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword && 416case SyntaxKind.WhereKeyword: 425if (nextToken.Kind() == SyntaxKind.CloseBraceToken) 430nextToken.Kind() is SyntaxKind.CatchKeyword or 431SyntaxKind.FinallyKeyword or 432SyntaxKind.ElseKeyword) 437nextToken.Kind() == SyntaxKind.WhileKeyword && 438nextToken.Parent.IsKind(SyntaxKind.DoStatement)) 442else if (nextToken.Kind() == SyntaxKind.EndOfFileToken) 458else if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 482return trivia.Kind() is SyntaxKind.WhitespaceTrivia 483or SyntaxKind.EndOfLineTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\EndOfFileTokenFormattingRule.cs (2)
17if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 29if (currentToken.Kind() == SyntaxKind.EndOfFileToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (7)
95var firstStatementIsBlock = section.Statements is [(kind: SyntaxKind.Block), ..]; 222if (node.IsLambdaBodyBlock() || node.IsAnonymousMethodBlock() || node.Kind() is SyntaxKind.PropertyPatternClause or SyntaxKind.SwitchExpression) 228if (node.IsKind(SyntaxKind.ArrayInitializerExpression) && node.Parent != null && node.Parent.IsKind(SyntaxKind.ArrayCreationExpression)) 262if (node.Parent != null && node.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (79)
44if (node.IsKind(SyntaxKind.SwitchStatement)) 53case SyntaxKind.IfStatement: 54case SyntaxKind.ElseClause: 55case SyntaxKind.WhileStatement: 56case SyntaxKind.DoStatement: 57case SyntaxKind.ForEachStatement: 58case SyntaxKind.ForEachVariableStatement: 59case SyntaxKind.UsingStatement: 60case SyntaxKind.ForStatement: 61case SyntaxKind.TryStatement: 62case SyntaxKind.CatchClause: 63case SyntaxKind.FinallyClause: 64case SyntaxKind.LockStatement: 65case SyntaxKind.CheckedStatement: 66case SyntaxKind.UncheckedStatement: 67case SyntaxKind.SwitchSection: 68case SyntaxKind.FixedStatement: 69case SyntaxKind.UnsafeStatement: 83if (previousToken.IsKind(SyntaxKind.CloseBraceToken) 84&& currentToken.IsKind(SyntaxKind.ElseKeyword) 94if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 103if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 112if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 121if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 130if (currentToken.IsKind(SyntaxKind.OpenBraceToken)) 132if (currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression 133or SyntaxKind.CollectionInitializerExpression 134or SyntaxKind.ArrayInitializerExpression 135or SyntaxKind.ImplicitArrayCreationExpression 136or SyntaxKind.WithInitializerExpression) 143else if (currentToken.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 153var isFirstTokenOfSwitchArm = currentToken.Parent.IsParentKind(SyntaxKind.RecursivePattern, out RecursivePatternSyntax? recursivePattern) 154&& recursivePattern.IsParentKind(SyntaxKind.SwitchExpressionArm, out SwitchExpressionArmSyntax? switchExpressionArm) 170if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 183if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 192if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 201if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 210if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 211currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 220if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 229if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 249if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression)) 263if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 277if (previousToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.IsKind(SyntaxKind.ElseKeyword)) 291if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 304if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 317if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 330if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 346if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 347currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression or SyntaxKind.WithInitializerExpression or SyntaxKind.PropertyPatternClause) 363if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 364currentToken.Parent.Kind() is SyntaxKind.ArrayInitializerExpression or SyntaxKind.ImplicitArrayCreationExpression) 374if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 392if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 405if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 418if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 431if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 432currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 445if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 458if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 473if (previousToken.IsKind(SyntaxKind.SemicolonToken) 474&& (previousToken.Parent is StatementSyntax && !previousToken.Parent.IsKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\QueryExpressionFormattingRule.cs (7)
169case SyntaxKind.FromKeyword: 170case SyntaxKind.WhereKeyword: 171case SyntaxKind.LetKeyword: 172case SyntaxKind.JoinKeyword: 173case SyntaxKind.OrderByKeyword: 174case SyntaxKind.GroupKeyword: 175case SyntaxKind.SelectKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (165)
47var previousKind = previousToken.Kind(); 48var currentKind = currentToken.Kind(); 49var previousParentKind = previousToken.Parent.Kind(); 50var currentParentKind = currentToken.Parent.Kind(); 53if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.IdentifierToken) 65if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.GreaterThanToken) 68if (currentToken.IsOpenParenInParameterListOfParenthesizedLambdaExpression() && previousParentKind == SyntaxKind.TypeArgumentList) 73if (previousParentKind == SyntaxKind.TypeParameterList) 85if ((previousToken.IsKeyword() || previousToken.Kind() is SyntaxKind.QuestionToken or SyntaxKind.AsteriskToken or SyntaxKind.CloseBracketToken or SyntaxKind.CloseParenToken or SyntaxKind.GreaterThanToken) 92if (previousToken.Parent.IsKind(SyntaxKind.OperatorDeclaration) && currentToken.IsOpenParenInParameterListOfAOperationDeclaration()) 137if (currentKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 142if (previousKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(previousParentKind)) 147if (currentKind == SyntaxKind.CloseParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 153if (currentKind == SyntaxKind.OpenParenToken && 154(previousKind == SyntaxKind.IfKeyword || previousKind == SyntaxKind.WhileKeyword || previousKind == SyntaxKind.SwitchKeyword || 155previousKind == SyntaxKind.ForKeyword || previousKind == SyntaxKind.ForEachKeyword || previousKind == SyntaxKind.CatchKeyword || 156previousKind == SyntaxKind.UsingKeyword || previousKind == SyntaxKind.WhenKeyword || previousKind == SyntaxKind.LockKeyword || 157previousKind == SyntaxKind.FixedKeyword)) 163if ((previousToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && previousKind == SyntaxKind.OpenParenToken) || 164(currentToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && currentKind == SyntaxKind.CloseParenToken)) 170if ((previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.OpenParenToken) || 171(currentParentKind == SyntaxKind.CastExpression && currentKind == SyntaxKind.CloseParenToken)) 177if (previousParentKind == SyntaxKind.ForStatement 180if (currentKind == SyntaxKind.SemicolonToken 181&& (previousKind != SyntaxKind.SemicolonToken 191if (previousKind == SyntaxKind.OpenParenToken && IsControlFlowLikeKeywordStatementKind(previousParentKind)) 196if (currentKind == SyntaxKind.CloseParenToken && IsControlFlowLikeKeywordStatementKind(currentParentKind)) 202if (previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.CloseParenToken) 208if (currentKind == SyntaxKind.OpenBracketToken && currentToken.Parent.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression) 211if (previousKind == SyntaxKind.CommaToken) 217if (previousKind is not (SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken)) 224if (currentKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(currentToken) && !previousToken.IsOpenBraceOrCommaOfObjectInitializer()) 230if (((currentKind == SyntaxKind.CloseBracketToken && previousKind == SyntaxKind.OpenBracketToken) 231|| currentKind == SyntaxKind.OmittedArraySizeExpressionToken) 238if (previousKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(previousToken)) 243if (currentKind == SyntaxKind.CloseBracketToken && previousKind != SyntaxKind.OmittedArraySizeExpressionToken && HasFormattableBracketParent(currentToken)) 249if (previousKind == SyntaxKind.CloseBracketToken && previousToken.Parent.IsKind(SyntaxKind.AttributeList)) 252if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 253currentToken.Parent.IsKind(SyntaxKind.AttributeList)) 259if (currentToken.IsKind(SyntaxKind.EndOfFileToken)) 292bool IsCommaWithCustomSpacing(SyntaxToken previousToken, SyntaxToken currentToken, SyntaxKind currentKind, SyntaxKind previousKind, bool checkPreviousToken) 295var tokenKind = checkPreviousToken ? previousKind : currentKind; 296var otherKind = checkPreviousToken ? currentKind : previousKind; 298return (token.IsCommaInArgumentOrParameterList() && otherKind != SyntaxKind.OmittedTypeArgumentToken) 304|| (tokenKind == SyntaxKind.CommaToken 305&& otherKind != SyntaxKind.OmittedArraySizeExpressionToken 322if (previousToken.IsSemicolonInForStatement() && currentKind != SyntaxKind.CloseParenToken) 338currentToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern || 339previousToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern) 346if (currentKind == SyntaxKind.IsKeyword || 347currentKind == SyntaxKind.AsKeyword || 348currentKind == SyntaxKind.AndKeyword || 349currentKind == SyntaxKind.OrKeyword || 350previousKind == SyntaxKind.IsKeyword || 351previousKind == SyntaxKind.AsKeyword || 352previousKind == SyntaxKind.AndKeyword || 353previousKind == SyntaxKind.OrKeyword) 371if (previousParentKind == SyntaxKind.FunctionPointerType) 374if (currentKind == SyntaxKind.AsteriskToken && previousKind == SyntaxKind.DelegateKeyword) 380if (previousKind == SyntaxKind.AsteriskToken && currentParentKind == SyntaxKind.FunctionPointerCallingConvention) 384case SyntaxKind.IdentifierToken: 385case SyntaxKind.ManagedKeyword: 386case SyntaxKind.UnmanagedKeyword: 392if (currentParentKind == SyntaxKind.FunctionPointerParameterList && currentKind == SyntaxKind.LessThanToken) 397case SyntaxKind.AsteriskToken: 400case SyntaxKind.ManagedKeyword: 401case SyntaxKind.UnmanagedKeyword: 404case SyntaxKind.CloseBracketToken when previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList: 411if (previousParentKind == SyntaxKind.FunctionPointerCallingConvention && currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && currentKind == SyntaxKind.OpenBracketToken) 417if (currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList) 419if (currentKind == SyntaxKind.IdentifierToken) 423if (previousKind == SyntaxKind.OpenBracketToken) 429else if (previousKind == SyntaxKind.CommaToken) 437if (currentKind == SyntaxKind.CommaToken) 444if (currentKind == SyntaxKind.CloseBracketToken) 452if (previousKind == SyntaxKind.LessThanToken && previousParentKind == SyntaxKind.FunctionPointerParameterList) 459if (currentKind == SyntaxKind.GreaterThanToken && currentParentKind == SyntaxKind.FunctionPointerParameterList) 465if (previousToken.Parent.IsKind(SyntaxKind.NotPattern)) 472if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.SlicePattern) 478if (previousKind is SyntaxKind.InterpolatedStringStartToken or 479SyntaxKind.InterpolatedVerbatimStringStartToken or 480SyntaxKind.InterpolatedSingleLineRawStringStartToken or 481SyntaxKind.InterpolatedMultiLineRawStringStartToken) 487if (currentKind is SyntaxKind.InterpolatedStringEndToken or 488SyntaxKind.InterpolatedRawStringEndToken) 494if ((currentKind == SyntaxKind.OpenBraceToken && currentToken.Parent is InterpolationSyntax) || 495(previousKind == SyntaxKind.CloseBraceToken && previousToken.Parent is InterpolationSyntax)) 501if (previousKind == SyntaxKind.OpenBraceToken && previousToken.Parent is InterpolationSyntax) 507if (currentKind == SyntaxKind.CloseBraceToken && currentToken.Parent is InterpolationSyntax interpolation) 518if ((previousKind == SyntaxKind.CommaToken && previousToken.Parent is InterpolationAlignmentClauseSyntax) || 519(currentKind == SyntaxKind.CommaToken && currentToken.Parent is InterpolationAlignmentClauseSyntax)) 525if ((previousKind == SyntaxKind.ColonToken && previousToken.Parent is InterpolationFormatClauseSyntax) || 526(currentKind == SyntaxKind.ColonToken && currentToken.Parent is InterpolationFormatClauseSyntax)) 538if (previousKind == SyntaxKind.CaretToken && previousParentKind == SyntaxKind.IndexExpression) 544if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.RangeExpression) 555if (currentKind == SyntaxKind.DotDotToken && currentParentKind == SyntaxKind.RangeExpression) 581is SyntaxKind.FieldDeclaration 582or SyntaxKind.EventDeclaration 583or SyntaxKind.EventFieldDeclaration 584or SyntaxKind.LocalDeclarationStatement 585or SyntaxKind.EnumMemberDeclaration) 610=> token.Parent is (kind: SyntaxKind.ArrayRankSpecifier or SyntaxKind.BracketedArgumentList or SyntaxKind.BracketedParameterList or SyntaxKind.ImplicitArrayCreationExpression or SyntaxKind.ListPattern or SyntaxKind.CollectionExpression); 612private static bool IsFunctionLikeKeywordExpressionKind(SyntaxKind syntaxKind) 613=> (syntaxKind is SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression); 615private static bool IsControlFlowLikeKeywordStatementKind(SyntaxKind syntaxKind) 617return syntaxKind is SyntaxKind.IfStatement or SyntaxKind.WhileStatement or SyntaxKind.SwitchStatement or 618SyntaxKind.ForStatement or SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement or 619SyntaxKind.DoStatement or 620SyntaxKind.CatchDeclaration or SyntaxKind.UsingStatement or SyntaxKind.LockStatement or 621SyntaxKind.FixedStatement or SyntaxKind.CatchFilterClause;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\StructuredTriviaFormattingRule.cs (8)
31((previousToken.Kind() == SyntaxKind.HashToken && currentToken.Kind() == SyntaxKind.ColonToken) || 32(previousToken.Kind() == SyntaxKind.ColonToken && currentToken.Kind() == SyntaxKind.StringLiteralToken))) 38if (previousToken.Kind() == SyntaxKind.HashToken && SyntaxFacts.IsPreprocessorKeyword(currentToken.Kind())) 43if (previousToken.Kind() == SyntaxKind.RegionKeyword && currentToken.Kind() == SyntaxKind.EndOfDirectiveToken) 48if (currentToken.Kind() == SyntaxKind.EndOfDirectiveToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (8)
80if (node.IsKind(SyntaxKind.SwitchExpressionArm)) 88if (node.IsKind(SyntaxKind.SwitchExpression)) 257if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 314if (!IsFormatDirective(pragmaWarningDirectiveTrivia, SyntaxKind.DisableKeyword)) 321var endDirective = pragmaWarningDirectiveTrivia.GetNextDirective(trivia => IsFormatDirective(trivia, SyntaxKind.RestoreKeyword)); 326Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None)); 332private static bool IsFormatDirective(DirectiveTriviaSyntax? trivia, SyntaxKind disableOrRestoreKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (101)
52case SyntaxKind.OpenBraceToken: 61case SyntaxKind.CloseBraceToken: 69if (previousToken.Kind() == SyntaxKind.CloseBraceToken && currentToken.Kind() == SyntaxKind.WhileKeyword) 77case SyntaxKind.CloseBraceToken: 83if (!currentToken.IsKind(SyntaxKind.SemicolonToken) && 103case SyntaxKind.OpenBraceToken: 144if (previousToken.Kind() == SyntaxKind.ElseKeyword) 146var isElseIfOnSameLine = currentToken.Kind() == SyntaxKind.IfKeyword && FormattingHelpers.AreOnSameLine(previousToken, currentToken); 165if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 170if (previousToken.Kind() == SyntaxKind.DoKeyword && previousToken.Parent.IsKind(SyntaxKind.DoStatement)) 182if (previousToken.Kind() == SyntaxKind.SemicolonToken && 183(currentToken.Kind() == SyntaxKind.CaseKeyword || currentToken.Kind() == SyntaxKind.DefaultKeyword || currentToken.Kind() == SyntaxKind.ElseKeyword)) 189if (previousToken.Kind() == SyntaxKind.SemicolonToken) 194if (currentToken.Kind() == SyntaxKind.SemicolonToken && 203if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 301if (usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword)) 315if (currentToken.Kind() == SyntaxKind.SemicolonToken) 318if (previousToken.Kind() == SyntaxKind.SemicolonToken) 322if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 330if (previousToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 331previousToken.Kind() == SyntaxKind.OmittedTypeArgumentToken || 332currentToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 333currentToken.Kind() == SyntaxKind.OmittedTypeArgumentToken) 338if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 339previousToken.Parent.IsKind(SyntaxKind.AttributeList) && 340previousToken.Parent.IsParentKind(SyntaxKind.Parameter)) 342if (currentToken.IsKind(SyntaxKind.OpenBracketToken)) 358if (currentToken.Kind() == SyntaxKind.OpenParenToken && 359previousToken.Kind() == SyntaxKind.ThisKeyword) 364if (previousToken.Kind() == SyntaxKind.NewKeyword) 369SyntaxKind.ConstructorConstraint or 370SyntaxKind.ImplicitObjectCreationExpression or 371SyntaxKind.ImplicitArrayCreationExpression) ? 0 : 1; 376if (currentToken.Kind() == SyntaxKind.OpenParenToken) 379is SyntaxKind.IdentifierToken 380or SyntaxKind.DefaultKeyword 381or SyntaxKind.BaseKeyword 382or SyntaxKind.ThisKeyword 384or SyntaxKind.ExtensionKeyword 401if (previousToken.Kind() == SyntaxKind.CommaToken && currentToken.Kind() == SyntaxKind.OpenBracketToken && currentToken.Parent is AttributeListSyntax) 407if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 420case SyntaxKind.CloseParenToken: 421case SyntaxKind.CloseBracketToken: 422case SyntaxKind.CommaToken: 423case SyntaxKind.DotToken: 424case SyntaxKind.MinusGreaterThanToken: 429if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 430currentToken.Parent?.Kind() is not SyntaxKind.CollectionExpression and not SyntaxKind.AttributeList && 448if (currentToken.IsKind(SyntaxKind.ColonToken) && 450SyntaxKind.AttributeTargetSpecifier or 451SyntaxKind.CaseSwitchLabel or 452SyntaxKind.CasePatternSwitchLabel or 453SyntaxKind.DefaultSwitchLabel or 454SyntaxKind.ExpressionColon or 458SyntaxKind.LabeledStatement or 459SyntaxKind.NameColon or 460SyntaxKind.SwitchExpressionArm)) 467previousToken.Kind() == SyntaxKind.CloseParenToken) 473if (previousToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList or SyntaxKind.FunctionPointerType)) 476if (previousToken.Kind() == SyntaxKind.LessThanToken) 482if (previousToken.Kind() == SyntaxKind.GreaterThanToken && currentToken.Kind() == SyntaxKind.GreaterThanToken) 489if ((currentToken.Kind() == SyntaxKind.LessThanToken || currentToken.Kind() == SyntaxKind.GreaterThanToken) && 490currentToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList)) 496if ((previousToken.Kind() == SyntaxKind.PlusPlusToken || previousToken.Kind() == SyntaxKind.MinusMinusToken) && 503if ((currentToken.Kind() == SyntaxKind.PlusPlusToken || currentToken.Kind() == SyntaxKind.MinusMinusToken) && 510if (currentToken.IsKind(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression)) 516if (currentToken.Kind() == SyntaxKind.QuestionToken && 517currentToken.Parent is (kind: SyntaxKind.NullableType or SyntaxKind.ClassConstraint)) 523if (currentToken.IsKind(SyntaxKind.QuestionToken) && 524previousToken.Parent?.IsParentKind(SyntaxKind.ArrayType) == true) 530if (currentToken.Kind() == SyntaxKind.ExclamationToken && 531currentToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 537if (currentToken.Kind() == SyntaxKind.AsteriskToken && currentToken.Parent is PointerTypeSyntax) 543if (previousToken.Kind() == SyntaxKind.AsteriskToken && previousToken.Parent is PrefixUnaryExpressionSyntax) 551case SyntaxKind.OpenParenToken: 552case SyntaxKind.OpenBracketToken: 553case SyntaxKind.DotToken: 554case SyntaxKind.MinusGreaterThanToken: 557case SyntaxKind.CloseParenToken: 558case SyntaxKind.CloseBracketToken: 577if (previousToken.Kind() == SyntaxKind.ExclamationToken 578&& !previousToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 584if (previousToken.Kind() == SyntaxKind.TildeToken && (previousToken.Parent is PrefixUnaryExpressionSyntax or DestructorDeclarationSyntax)) 590if (previousToken.Kind() == SyntaxKind.AmpersandToken && 597if (previousToken.Kind() == SyntaxKind.ColonColonToken || currentToken.Kind() == SyntaxKind.ColonColonToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (9)
70if (embeddedStatement.IsKind(SyntaxKind.Block)) 91if (!firstToken.IsKind(SyntaxKind.None) || !lastToken.IsKind(SyntaxKind.None)) 99if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 112if (!(node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block)) 121if (!tokens.firstToken.IsKind(SyntaxKind.None) || !tokens.lastToken.IsKind(SyntaxKind.None)) 179if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (14)
47Contract.ThrowIfTrue(startToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 48Contract.ThrowIfTrue(endToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 71return endToken.IsKind(SyntaxKind.CloseBraceToken) && 72endToken.Parent.IsKind(SyntaxKind.Block) && 73endToken.Parent.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.DoStatement; 78Contract.ThrowIfTrue(token.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 82if (previousToken.Kind() == SyntaxKind.None) 93if (token.IsKind(SyntaxKind.OpenBraceToken) && 98if (nextToken.IsKind(SyntaxKind.CloseBraceToken)) 107if (token.IsKind(SyntaxKind.OpenBraceToken) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (12)
245modifiers.Any(SyntaxKind.PartialKeyword)) 286AssignmentExpressionSyntax _ when token.Kind() == SyntaxKind.EqualsToken => GetDeconstructionAssignmentMethods(semanticModel, node).As<ISymbol>(), 287ForEachVariableStatementSyntax _ when token.Kind() == SyntaxKind.InKeyword => GetDeconstructionForEachMethods(semanticModel, node).As<ISymbol>(), 310if (token.Kind() == SyntaxKind.CommaToken) 320if (ordering.AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 324else if (orderByClauseSyntax.Orderings[0].AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 343return token.IsKind(SyntaxKind.InKeyword) ? queryInfo.CastInfo.GetBestOrAllSymbols() : queryInfo.OperationInfo.GetBestOrAllSymbols(); 369if (token.IsKind(SyntaxKind.CommaToken)) 479SyntaxKind.IfDirectiveTrivia or 480SyntaxKind.ElifDirectiveTrivia or 481SyntaxKind.DefineDirectiveTrivia or 482SyntaxKind.UndefDirectiveTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (53)
24case SyntaxKind.ClassDeclaration: 25case SyntaxKind.RecordDeclaration: 26case SyntaxKind.StructDeclaration: 27case SyntaxKind.RecordStructDeclaration: 28case SyntaxKind.InterfaceDeclaration: 29case SyntaxKind.EnumDeclaration: 30case SyntaxKind.DelegateDeclaration: 31return ignoreDeclarationModifiers || !((MemberDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.FileKeyword); 33case SyntaxKind.FieldDeclaration: 34case SyntaxKind.EventFieldDeclaration: 35case SyntaxKind.GetAccessorDeclaration: 36case SyntaxKind.SetAccessorDeclaration: 37case SyntaxKind.InitAccessorDeclaration: 38case SyntaxKind.AddAccessorDeclaration: 39case SyntaxKind.RemoveAccessorDeclaration: 42case SyntaxKind.VariableDeclaration: 45case SyntaxKind.VariableDeclarator: 48case SyntaxKind.ConstructorDeclaration: 50return ignoreDeclarationModifiers || !((ConstructorDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.StaticKeyword); 52case SyntaxKind.PropertyDeclaration: 55case SyntaxKind.IndexerDeclaration: 58case SyntaxKind.OperatorDeclaration: 61case SyntaxKind.ConversionOperatorDeclaration: 64case SyntaxKind.MethodDeclaration: 72if (method.Modifiers.Any(SyntaxKind.PartialKeyword)) 80case SyntaxKind.EventDeclaration: 108(SyntaxKind.PublicKeyword, _) => Accessibility.Public, 110(SyntaxKind.PrivateKeyword, Accessibility.Protected) => Accessibility.ProtectedAndInternal, 111(SyntaxKind.PrivateKeyword, _) => Accessibility.Private, 113(SyntaxKind.InternalKeyword, Accessibility.Protected) => Accessibility.ProtectedOrInternal, 114(SyntaxKind.InternalKeyword, _) => Accessibility.Internal, 116(SyntaxKind.ProtectedKeyword, Accessibility.Private) => Accessibility.ProtectedAndInternal, 117(SyntaxKind.ProtectedKeyword, Accessibility.Internal) => Accessibility.ProtectedOrInternal, 118(SyntaxKind.ProtectedKeyword, _) => Accessibility.Protected, 125SyntaxKind.AbstractKeyword => Modifiers.Abstract, 126SyntaxKind.NewKeyword => Modifiers.New, 127SyntaxKind.OverrideKeyword => Modifiers.Override, 128SyntaxKind.VirtualKeyword => Modifiers.Virtual, 129SyntaxKind.StaticKeyword => Modifiers.Static, 130SyntaxKind.AsyncKeyword => Modifiers.Async, 131SyntaxKind.ConstKeyword => Modifiers.Const, 132SyntaxKind.ReadOnlyKeyword => Modifiers.ReadOnly, 133SyntaxKind.SealedKeyword => Modifiers.Sealed, 134SyntaxKind.UnsafeKeyword => Modifiers.Unsafe, 135SyntaxKind.PartialKeyword => Modifiers.Partial, 136SyntaxKind.RefKeyword => Modifiers.Ref, 137SyntaxKind.VolatileKeyword => Modifiers.Volatile, 138SyntaxKind.ExternKeyword => Modifiers.Extern, 139SyntaxKind.FileKeyword => Modifiers.File, 141SyntaxKind.ClosedKeyword => Modifiers.Closed, 143SyntaxKind.RequiredKeyword => Modifiers.Required, 144SyntaxKind.FixedKeyword => Modifiers.Fixed, 148isDefault |= token.Kind() == SyntaxKind.DefaultKeyword;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (4)
22=> node.IsKind(SyntaxKind.Block); 25=> node is (kind: SyntaxKind.Block or SyntaxKind.SwitchSection or SyntaxKind.CompilationUnit);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpFileBannerFacts.cs (4)
22=> trivia.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (175)
101var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 110var kind = token.Kind(); 149if (lineDirective.Line.Kind() == SyntaxKind.DefaultKeyword) 154else if (lineDirective.Line.Kind() == SyntaxKind.NumericLiteralToken && 201=> node is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList); 222=> node is LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not (int)SyntaxKind.None }; 268=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.ThisConstructorInitializer) constructorInit && 272=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.BaseConstructorInitializer) constructorInit && 282case SyntaxKind.FromKeyword: 283case SyntaxKind.JoinKeyword: 284case SyntaxKind.LetKeyword: 285case SyntaxKind.OrderByKeyword: 286case SyntaxKind.WhereKeyword: 287case SyntaxKind.OnKeyword: 288case SyntaxKind.EqualsKeyword: 289case SyntaxKind.InKeyword: 291case SyntaxKind.ByKeyword: 292case SyntaxKind.GroupKeyword: 293case SyntaxKind.SelectKeyword: 295case SyntaxKind.AscendingKeyword: 296case SyntaxKind.DescendingKeyword: 298case SyntaxKind.IntoKeyword: 299return token.Parent is (kind: SyntaxKind.JoinIntoClause or SyntaxKind.QueryContinuation); 326SyntaxKind.BoolKeyword => PredefinedType.Boolean, 327SyntaxKind.ByteKeyword => PredefinedType.Byte, 328SyntaxKind.SByteKeyword => PredefinedType.SByte, 329SyntaxKind.IntKeyword => PredefinedType.Int32, 330SyntaxKind.UIntKeyword => PredefinedType.UInt32, 331SyntaxKind.ShortKeyword => PredefinedType.Int16, 332SyntaxKind.UShortKeyword => PredefinedType.UInt16, 333SyntaxKind.LongKeyword => PredefinedType.Int64, 334SyntaxKind.ULongKeyword => PredefinedType.UInt64, 335SyntaxKind.FloatKeyword => PredefinedType.Single, 336SyntaxKind.DoubleKeyword => PredefinedType.Double, 337SyntaxKind.DecimalKeyword => PredefinedType.Decimal, 338SyntaxKind.StringKeyword => PredefinedType.String, 339SyntaxKind.CharKeyword => PredefinedType.Char, 340SyntaxKind.ObjectKeyword => PredefinedType.Object, 341SyntaxKind.VoidKeyword => PredefinedType.Void, 342SyntaxKind.IdentifierToken => token.Text switch 365switch ((SyntaxKind)token.RawKind) 367case SyntaxKind.PlusToken: 368case SyntaxKind.PlusEqualsToken: 371case SyntaxKind.MinusToken: 372case SyntaxKind.MinusEqualsToken: 375case SyntaxKind.AmpersandAmpersandToken: // overridden bitwise & can be accessed through && 376case SyntaxKind.AmpersandToken: 377case SyntaxKind.AmpersandEqualsToken: 380case SyntaxKind.BarBarToken: // overridden bitwise | can be accessed through || 381case SyntaxKind.BarToken: 382case SyntaxKind.BarEqualsToken: 385case SyntaxKind.MinusMinusToken: 388case SyntaxKind.PlusPlusToken: 391case SyntaxKind.SlashToken: 392case SyntaxKind.SlashEqualsToken: 395case SyntaxKind.EqualsEqualsToken: 398case SyntaxKind.CaretToken: 399case SyntaxKind.CaretEqualsToken: 402case SyntaxKind.GreaterThanToken: 405case SyntaxKind.GreaterThanEqualsToken: 408case SyntaxKind.ExclamationEqualsToken: 411case SyntaxKind.LessThanLessThanToken: 412case SyntaxKind.LessThanLessThanEqualsToken: 415case SyntaxKind.LessThanToken: 418case SyntaxKind.LessThanEqualsToken: 421case SyntaxKind.AsteriskToken: 422case SyntaxKind.AsteriskEqualsToken: 425case SyntaxKind.PercentToken: 426case SyntaxKind.PercentEqualsToken: 429case SyntaxKind.ExclamationToken: 430case SyntaxKind.TildeToken: 433case SyntaxKind.GreaterThanGreaterThanToken: 434case SyntaxKind.GreaterThanGreaterThanEqualsToken: 437case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 438case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 446=> SyntaxFacts.GetText((SyntaxKind)kind); 478case SyntaxKind.NumericLiteralToken: 479case SyntaxKind.CharacterLiteralToken: 480case SyntaxKind.StringLiteralToken: 481case SyntaxKind.Utf8StringLiteralToken: 482case SyntaxKind.SingleLineRawStringLiteralToken: 483case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 484case SyntaxKind.MultiLineRawStringLiteralToken: 485case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 486case SyntaxKind.NullKeyword: 487case SyntaxKind.TrueKeyword: 488case SyntaxKind.FalseKeyword: 489case SyntaxKind.InterpolatedStringStartToken: 490case SyntaxKind.InterpolatedStringEndToken: 491case SyntaxKind.InterpolatedRawStringEndToken: 492case SyntaxKind.InterpolatedVerbatimStringStartToken: 493case SyntaxKind.InterpolatedStringTextToken: 494case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 495case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 503=> token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken; 511case SyntaxKind.DelegateKeyword: 512case SyntaxKind.VoidKeyword: 520if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.OrderByClause)) 523if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CloseBracketToken) 525if (token.Parent.IsKind(SyntaxKind.CollectionExpression)) 545=> (node as MemberAccessExpressionSyntax)?.Kind() == SyntaxKind.PointerMemberAccessExpression; 555=> simpleName.IsKind(SyntaxKind.GenericName) || 556simpleName.GetLastToken().GetNextToken().Kind() == SyntaxKind.LessThanToken; 587=> node.IsKind(SyntaxKind.BaseList); 599=> node.IsKind(SyntaxKind.Argument); 602=> node.IsKind(SyntaxKind.AttributeArgument); 607argument.RefOrOutKeyword.Kind() == SyntaxKind.None && 635=> node.IsKind(SyntaxKind.IdentifierName) && 636node.IsParentKind(SyntaxKind.NameColon) && 637node.Parent.IsParentKind(SyntaxKind.Subpattern); 640=> node.Kind() == SyntaxKind.PropertyPatternClause; 649if (identifier.Parent.IsParentKind(SyntaxKind.WithInitializerExpression)) 655else if (identifier.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression)) 663else if (objectInitializer?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment) 694=> node.IsKind(SyntaxKind.ElementAccessExpression); 724var kind = node.Kind(); 725if ((kind != SyntaxKind.GlobalStatement) && (kind != SyntaxKind.IncompleteMember) && (node is TMemberDeclarationSyntax)) 816case SyntaxKind.CompilationUnit: 818case SyntaxKind.IdentifierName: 821case SyntaxKind.IncompleteMember: 823case SyntaxKind.NamespaceDeclaration: 824case SyntaxKind.FileScopedNamespaceDeclaration: 826case SyntaxKind.QualifiedName: 840if (memberDeclaration.Kind() == SyntaxKind.DestructorDeclaration) 865Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember); 1016if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 1022if (token.Kind() == SyntaxKind.EndOfFileToken) 1091=> node?.Parent?.Kind() is SyntaxKind.PostIncrementExpression or SyntaxKind.PreIncrementExpression; 1094=> node?.Parent?.Kind() is SyntaxKind.PostDecrementExpression or SyntaxKind.PreDecrementExpression; 1107SyntaxKind.SingleLineRawStringLiteralToken or 1108SyntaxKind.MultiLineRawStringLiteralToken or 1109SyntaxKind.Utf8SingleLineRawStringLiteralToken or 1110SyntaxKind.Utf8MultiLineRawStringLiteralToken; 1113=> token.Kind() == SyntaxKind.NumericLiteralToken; 1139=> trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia; 1145=> node?.Kind() is SyntaxKind.UsingDirective or SyntaxKind.ExternAliasDirective; 1148=> IsGlobalAttribute(node, SyntaxKind.AssemblyKeyword); 1151=> IsGlobalAttribute(node, SyntaxKind.ModuleKeyword); 1153private static bool IsGlobalAttribute([NotNullWhen(true)] SyntaxNode? node, SyntaxKind attributeTarget) 1154=> node.IsKind(SyntaxKind.Attribute) && 1183case SyntaxKind.VariableDeclarator: 1184return node.Parent?.Parent?.Kind() is SyntaxKind.FieldDeclaration or SyntaxKind.EventFieldDeclaration; 1186case SyntaxKind.FieldDeclaration: 1187case SyntaxKind.MethodDeclaration: 1188case SyntaxKind.PropertyDeclaration: 1189case SyntaxKind.GetAccessorDeclaration: 1190case SyntaxKind.SetAccessorDeclaration: 1191case SyntaxKind.EventDeclaration: 1192case SyntaxKind.EventFieldDeclaration: 1193case SyntaxKind.AddAccessorDeclaration: 1194case SyntaxKind.RemoveAccessorDeclaration: 1195case SyntaxKind.IndexerDeclaration: 1196case SyntaxKind.OperatorDeclaration: 1197case SyntaxKind.ConversionOperatorDeclaration: 1198case SyntaxKind.ConstructorDeclaration: 1199case SyntaxKind.DestructorDeclaration: 1211=> node is ExpressionStatementSyntax { Expression: (kind: SyntaxKind.SimpleAssignmentExpression) }; 1332if (token.Kind() == SyntaxKind.OverrideKeyword && token.Parent is MemberDeclarationSyntax member) 1440=> node is InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedVerbatimStringStartToken) }; 1482=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: IdentifierNameSyntax }; 1485=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: ImplicitElementAccessSyntax }; 1488=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression); 1491=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression); 1687=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression) initExpr ? initExpr.Expressions : default; 1690=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression) initExpr ? initExpr.Expressions : default;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxKinds.cs (151)
19=> (TSyntaxKind)(object)(SyntaxKind)kind; 23=> (int)(SyntaxKind)(object)kind; 25public int ConflictMarkerTrivia => (int)SyntaxKind.ConflictMarkerTrivia; 26public int DisabledTextTrivia => (int)SyntaxKind.DisabledTextTrivia; 27public int EndOfLineTrivia => (int)SyntaxKind.EndOfLineTrivia; 28public int SkippedTokensTrivia => (int)SyntaxKind.SkippedTokensTrivia; 29public int WhitespaceTrivia => (int)SyntaxKind.WhitespaceTrivia; 30public int SingleLineCommentTrivia => (int)SyntaxKind.SingleLineCommentTrivia; 31public int? MultiLineCommentTrivia => (int)SyntaxKind.MultiLineCommentTrivia; 32public int SingleLineDocCommentTrivia => (int)SyntaxKind.SingleLineDocumentationCommentTrivia; 33public int? MultiLineDocCommentTrivia => (int)SyntaxKind.MultiLineDocumentationCommentTrivia; 35public int IfDirectiveTrivia => (int)SyntaxKind.IfDirectiveTrivia; 36public int ElifDirectiveTrivia => (int)SyntaxKind.ElifDirectiveTrivia; 37public int ElseDirectiveTrivia => (int)SyntaxKind.ElseDirectiveTrivia; 38public int EndIfDirectiveTrivia => (int)SyntaxKind.EndIfDirectiveTrivia; 39public int RegionDirectiveTrivia => (int)SyntaxKind.RegionDirectiveTrivia; 40public int EndRegionDirectiveTrivia => (int)SyntaxKind.EndRegionDirectiveTrivia; 41public int? ShebangDirectiveTrivia => (int)SyntaxKind.ShebangDirectiveTrivia; 42public int DefineDirectiveTrivia => (int)SyntaxKind.DefineDirectiveTrivia; 43public int? UndefDirectiveTrivia => (int)SyntaxKind.UndefDirectiveTrivia; 45public int CloseBraceToken => (int)SyntaxKind.CloseBraceToken; 46public int? CloseBracketToken => (int)SyntaxKind.CloseBracketToken; 47public int CloseParenToken => (int)SyntaxKind.CloseParenToken; 48public int CommaToken => (int)SyntaxKind.CommaToken; 49public int ColonToken => (int)SyntaxKind.ColonToken; 50public int CharacterLiteralToken => (int)SyntaxKind.CharacterLiteralToken; 51public int DotToken => (int)SyntaxKind.DotToken; 52public int GreaterThanToken => (int)SyntaxKind.GreaterThanToken; 53public int InterpolatedStringTextToken => (int)SyntaxKind.InterpolatedStringTextToken; 54public int LessThanToken => (int)SyntaxKind.LessThanToken; 55public int LessThanSlashToken => (int)SyntaxKind.LessThanSlashToken; 56public int OpenBraceToken => (int)SyntaxKind.OpenBraceToken; 57public int? OpenBracketToken => (int)SyntaxKind.OpenBracketToken; 58public int OpenParenToken => (int)SyntaxKind.OpenParenToken; 59public int QuestionToken => (int)SyntaxKind.QuestionToken; 60public int StringLiteralToken => (int)SyntaxKind.StringLiteralToken; 61public int? SingleLineRawStringLiteralToken => (int)SyntaxKind.SingleLineRawStringLiteralToken; 62public int? MultiLineRawStringLiteralToken => (int)SyntaxKind.MultiLineRawStringLiteralToken; 63public int? Utf8StringLiteralToken => (int)SyntaxKind.Utf8StringLiteralToken; 64public int? Utf8SingleLineRawStringLiteralToken => (int)SyntaxKind.Utf8SingleLineRawStringLiteralToken; 65public int? Utf8MultiLineRawStringLiteralToken => (int)SyntaxKind.Utf8MultiLineRawStringLiteralToken; 67public int XmlCrefAttribute => (int)SyntaxKind.XmlCrefAttribute; 68public int XmlTextLiteralToken => (int)SyntaxKind.XmlTextLiteralToken; 70public int DelegateKeyword => (int)SyntaxKind.DelegateKeyword; 71public int FalseKeyword => (int)SyntaxKind.FalseKeyword; 72public int IfKeyword => (int)SyntaxKind.IfKeyword; 73public int NewKeyword => (int)SyntaxKind.NewKeyword; 74public int PartialKeyword => (int)SyntaxKind.PartialKeyword; 75public int TrueKeyword => (int)SyntaxKind.TrueKeyword; 76public int UsingKeyword => (int)SyntaxKind.UsingKeyword; 78public int? AliasQualifiedName => (int)SyntaxKind.AliasQualifiedName; 79public int GenericName => (int)SyntaxKind.GenericName; 80public int IdentifierName => (int)SyntaxKind.IdentifierName; 81public int QualifiedName => (int)SyntaxKind.QualifiedName; 83public int TupleType => (int)SyntaxKind.TupleType; 85public int CharacterLiteralExpression => (int)SyntaxKind.CharacterLiteralExpression; 86public int DefaultLiteralExpression => (int)SyntaxKind.DefaultLiteralExpression; 87public int FalseLiteralExpression => (int)SyntaxKind.FalseLiteralExpression; 88public int NullLiteralExpression => (int)SyntaxKind.NullLiteralExpression; 89public int NumericLiteralExpression => (int)SyntaxKind.NumericLiteralExpression; 90public int StringLiteralExpression => (int)SyntaxKind.StringLiteralExpression; 91public int TrueLiteralExpression => (int)SyntaxKind.TrueLiteralExpression; 93public int AddExpression => (int)SyntaxKind.AddExpression; 94public int AddressOfExpression => (int)SyntaxKind.AddressOfExpression; 95public int AnonymousObjectCreationExpression => (int)SyntaxKind.AnonymousObjectCreationExpression; 96public int ArrayCreationExpression => (int)SyntaxKind.ArrayCreationExpression; 97public int AwaitExpression => (int)SyntaxKind.AwaitExpression; 98public int BaseExpression => (int)SyntaxKind.BaseExpression; 99public int? CollectionExpression => (int)SyntaxKind.CollectionExpression; 100public int CollectionInitializerExpression => (int)SyntaxKind.CollectionInitializerExpression; 101public int ConditionalAccessExpression => (int)SyntaxKind.ConditionalAccessExpression; 102public int ConditionalExpression => (int)SyntaxKind.ConditionalExpression; 103public int? FieldExpression => (int)SyntaxKind.FieldExpression; 104public int? ImplicitArrayCreationExpression => (int)SyntaxKind.ImplicitArrayCreationExpression; 105public int? ImplicitObjectCreationExpression => (int)SyntaxKind.ImplicitObjectCreationExpression; 106public int? IndexExpression => (int)SyntaxKind.IndexExpression; 107public int InvocationExpression => (int)SyntaxKind.InvocationExpression; 108public int? IsPatternExpression => (int)SyntaxKind.IsPatternExpression; 109public int IsTypeExpression => (int)SyntaxKind.IsExpression; 111public int LogicalAndExpression => (int)SyntaxKind.LogicalAndExpression; 112public int LogicalOrExpression => (int)SyntaxKind.LogicalOrExpression; 113public int LogicalNotExpression => (int)SyntaxKind.LogicalNotExpression; 114public int ObjectCreationExpression => (int)SyntaxKind.ObjectCreationExpression; 115public int ParenthesizedExpression => (int)SyntaxKind.ParenthesizedExpression; 116public int QueryExpression => (int)SyntaxKind.QueryExpression; 117public int? RangeExpression => (int)SyntaxKind.RangeExpression; 118public int? RefExpression => (int)SyntaxKind.RefExpression; 119public int ReferenceEqualsExpression => (int)SyntaxKind.EqualsExpression; 120public int ReferenceNotEqualsExpression => (int)SyntaxKind.NotEqualsExpression; 121public int SimpleAssignmentExpression => (int)SyntaxKind.SimpleAssignmentExpression; 122public int SimpleMemberAccessExpression => (int)SyntaxKind.SimpleMemberAccessExpression; 123public int? SizeOfExpression => (int)SyntaxKind.SizeOfExpression; 124public int? SuppressNullableWarningExpression => (int)SyntaxKind.SuppressNullableWarningExpression; 125public int TernaryConditionalExpression => (int)SyntaxKind.ConditionalExpression; 126public int ThisExpression => (int)SyntaxKind.ThisExpression; 127public int? ThrowExpression => (int)SyntaxKind.ThrowExpression; 128public int TupleExpression => (int)SyntaxKind.TupleExpression; 129public int TypeOfExpression => (int)SyntaxKind.TypeOfExpression; 131public int? AndPattern => (int)SyntaxKind.AndPattern; 132public int? ConstantPattern => (int)SyntaxKind.ConstantPattern; 133public int? DeclarationPattern => (int)SyntaxKind.DeclarationPattern; 134public int? ListPattern => (int)SyntaxKind.ListPattern; 135public int? NotPattern => (int)SyntaxKind.NotPattern; 136public int? OrPattern => (int)SyntaxKind.OrPattern; 137public int? ParenthesizedPattern => (int)SyntaxKind.ParenthesizedPattern; 138public int? RecursivePattern => (int)SyntaxKind.RecursivePattern; 139public int? RelationalPattern => (int)SyntaxKind.RelationalPattern; 140public int? TypePattern => (int)SyntaxKind.TypePattern; 141public int? VarPattern => (int)SyntaxKind.VarPattern; 143public int EndOfFileToken => (int)SyntaxKind.EndOfFileToken; 144public int AwaitKeyword => (int)SyntaxKind.AwaitKeyword; 145public int AsyncKeyword => (int)SyntaxKind.AsyncKeyword; 146public int IdentifierToken => (int)SyntaxKind.IdentifierToken; 147public int GlobalKeyword => (int)SyntaxKind.GlobalKeyword; 148public int IncompleteMember => (int)SyntaxKind.IncompleteMember; 149public int HashToken => (int)SyntaxKind.HashToken; 151public int ExpressionStatement => (int)SyntaxKind.ExpressionStatement; 152public int ForEachStatement => (int)SyntaxKind.ForEachStatement; 153public int ForStatement => (int)SyntaxKind.ForStatement; 154public int IfStatement => (int)SyntaxKind.IfStatement; 155public int LocalDeclarationStatement => (int)SyntaxKind.LocalDeclarationStatement; 156public int? LocalFunctionStatement => (int)SyntaxKind.LocalFunctionStatement; 157public int LockStatement => (int)SyntaxKind.LockStatement; 158public int ReturnStatement => (int)SyntaxKind.ReturnStatement; 159public int ThrowStatement => (int)SyntaxKind.ThrowStatement; 160public int UsingStatement => (int)SyntaxKind.UsingStatement; 161public int WhileStatement => (int)SyntaxKind.WhileStatement; 162public int YieldReturnStatement => (int)SyntaxKind.YieldReturnStatement; 163public int Attribute => (int)SyntaxKind.Attribute; 164public int ClassDeclaration => (int)SyntaxKind.ClassDeclaration; 165public int ConstructorDeclaration => (int)SyntaxKind.ConstructorDeclaration; 166public int EnumDeclaration => (int)SyntaxKind.EnumDeclaration; 167public int InterfaceDeclaration => (int)SyntaxKind.InterfaceDeclaration; 168public int? StructDeclaration => (int)SyntaxKind.StructDeclaration; 169public int Parameter => (int)SyntaxKind.Parameter; 170public int TypeConstraint => (int)SyntaxKind.TypeConstraint; 171public int VariableDeclarator => (int)SyntaxKind.VariableDeclarator; 172public int FieldDeclaration => (int)SyntaxKind.FieldDeclaration; 173public int PropertyDeclaration => (int)SyntaxKind.PropertyDeclaration; 174public int ParameterList => (int)SyntaxKind.ParameterList; 175public int TypeArgumentList => (int)SyntaxKind.TypeArgumentList; 176public int? GlobalStatement => (int)SyntaxKind.GlobalStatement; 178public int ElseClause => (int)SyntaxKind.ElseClause; 179public int EqualsValueClause => (int)SyntaxKind.EqualsValueClause; 181public int? ExpressionElement => (int)SyntaxKind.ExpressionElement; 182public int? ImplicitElementAccess => (int)SyntaxKind.ImplicitElementAccess; 183public int Interpolation => (int)SyntaxKind.Interpolation; 184public int InterpolatedStringExpression => (int)SyntaxKind.InterpolatedStringExpression; 185public int InterpolatedStringText => (int)SyntaxKind.InterpolatedStringText; 186public int? IndexerMemberCref => (int)SyntaxKind.IndexerMemberCref; 187public int? PrimaryConstructorBaseType => (int)SyntaxKind.PrimaryConstructorBaseType;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (1)
14if (node.NameColon == null || !node.Parent.IsKind(SyntaxKind.TupleExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (21)
56return cast.Kind() == SyntaxKind.AsExpression && 126if (leftOrRightChild.Parent is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) binary) 160if (castExpression.WalkUpParentheses().Parent is PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression) parent && 187var isDefaultLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression); 231if (castSyntax.WalkUpParentheses().GetRequiredParent().Kind() is SyntaxKind.BitwiseOrExpression or SyntaxKind.OrAssignmentExpression) 334var isNullLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.NullLiteralExpression); 504if (castNode.WalkUpParentheses().Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) isExpression && 570if (castNode.IsParentKind(SyntaxKind.Interpolation) && originalConversionOperation.Type?.SpecialType is SpecialType.System_Object) 815if (parent is not PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression)) 820Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 947if (armExpression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 998if (castExpression.Expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 1063is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) parentBinary) 1151=> node is ExpressionSyntax expression && expression.WalkDownParentheses().Kind() is SyntaxKind.CastExpression or SyntaxKind.AsExpression; 1188if (otherSide.WalkDownParentheses().Kind() == SyntaxKind.NullLiteralExpression) 1257else if (castNode.Parent is InitializerExpressionSyntax(SyntaxKind.ArrayInitializerExpression) arrayInitializer) 1365if (!haveHitArgumentNode && currentOld.Kind() != SyntaxKind.Argument)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (46)
22Contract.ThrowIfTrue(endToken.Kind() == SyntaxKind.None); 40while (currentToken.Kind() != SyntaxKind.CloseBraceToken && previousToken.Kind() == SyntaxKind.OpenBraceToken) 43if (closeBrace.Kind() == SyntaxKind.None || !AreTwoTokensOnSameLine(previousToken, closeBrace)) 60case SyntaxKind.CloseBraceToken: 63case SyntaxKind.SemicolonToken: 66case SyntaxKind.ColonToken: 76if (endToken.Kind() == SyntaxKind.SkippedTokensTrivia) 88if (parent.Kind() is SyntaxKind.StringLiteralExpression or SyntaxKind.CharacterLiteralExpression) 100if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 152if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 252if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 259if (endToken.Kind() == SyntaxKind.ColonToken && parent is LabeledStatementSyntax) 268return previousToken.Kind() == SyntaxKind.None ? token : previousToken; 290if (previousToken.Kind() == SyntaxKind.None) 327return previousToken.IsKind(SyntaxKind.OpenBraceToken) && 328(previousToken.Parent.IsKind(SyntaxKind.Block) || 336node.Kind() is SyntaxKind.IfStatement or 337SyntaxKind.ElseClause or 338SyntaxKind.WhileStatement or 339SyntaxKind.ForStatement or 340SyntaxKind.ForEachStatement or 341SyntaxKind.ForEachVariableStatement or 342SyntaxKind.UsingStatement or 343SyntaxKind.DoStatement or 344SyntaxKind.TryStatement or 345SyntaxKind.CatchClause or 346SyntaxKind.FinallyClause or 347SyntaxKind.LabeledStatement or 348SyntaxKind.LockStatement or 349SyntaxKind.FixedStatement or 350SyntaxKind.UncheckedStatement or 351SyntaxKind.CheckedStatement or 352SyntaxKind.GetAccessorDeclaration or 353SyntaxKind.SetAccessorDeclaration or 354SyntaxKind.InitAccessorDeclaration or 355SyntaxKind.AddAccessorDeclaration or 356SyntaxKind.RemoveAccessorDeclaration; 388return token.Kind() == SyntaxKind.ColonToken && 395if (previousToken.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 400if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 417if (token.Kind() == SyntaxKind.CloseBraceToken) 419if (token.Parent.Kind() is SyntaxKind.Block or 420SyntaxKind.AccessorList)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\NameSyntaxComparer.cs (4)
84case SyntaxKind.QualifiedName: 89case SyntaxKind.AliasQualifiedName: 94case SyntaxKind.IdentifierName: 97case SyntaxKind.GenericName:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (57)
69=> expression.Kind() is SyntaxKind.ThisExpression or SyntaxKind.BaseExpression; 82if (node.Kind() is not SyntaxKind.PrimaryConstructorBaseType || 83previousNode.Kind() is SyntaxKind.ArgumentList) 96=> node is StatementSyntax(kind: not SyntaxKind.Block) or TypeSyntax or CrefSyntax || 97node.Kind() is SyntaxKind.Attribute or 98SyntaxKind.ThisConstructorInitializer or 99SyntaxKind.BaseConstructorInitializer or 100SyntaxKind.EqualsValueClause or 101SyntaxKind.ArrowExpressionClause or 102SyntaxKind.PrimaryConstructorBaseType; 109node => node.Kind() is SyntaxKind.UnknownAccessorDeclaration or SyntaxKind.IncompleteMember or SyntaxKind.BracketedArgumentList), 158case SyntaxKind.Attribute: 162case SyntaxKind.BaseConstructorInitializer: 163case SyntaxKind.ThisConstructorInitializer: 167case SyntaxKind.EqualsValueClause: 171case SyntaxKind.ArrowExpressionClause: 175case SyntaxKind.PrimaryConstructorBaseType: 201case SyntaxKind.ParenthesizedLambdaExpression: 235case SyntaxKind.SimpleLambdaExpression: 300if (currentOriginalNode.Kind() is SyntaxKind.CaseSwitchLabel or SyntaxKind.ConstantPattern) 303if (expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 315else if (currentOriginalNode.Kind() == SyntaxKind.LogicalNotExpression) 319else if (currentOriginalNode.Kind() == SyntaxKind.ConditionalAccessExpression) 336else if (currentOriginalNode.Kind() == SyntaxKind.VariableDeclarator) 467if (previousReplacedExpression.WalkDownParentheses().Kind() is SyntaxKind.NullLiteralExpression or SyntaxKind.DefaultLiteralExpression) 515else if (currentOriginalNode.Kind() == SyntaxKind.CollectionInitializerExpression) 520else if (currentOriginalNode.Kind() == SyntaxKind.ImplicitArrayCreationExpression) 529else if (currentOriginalNode.Kind() == SyntaxKind.DefaultExpression) 582SyntaxKind.InvocationExpression or 583SyntaxKind.ElementAccessExpression or 584SyntaxKind.SimpleMemberAccessExpression or 585SyntaxKind.ImplicitElementAccess or 586SyntaxKind.ObjectCreationExpression; 602SyntaxKind.InvocationExpression => ((InvocationExpressionSyntax)expression).ArgumentList, 603SyntaxKind.ObjectCreationExpression => ((ObjectCreationExpressionSyntax)expression).ArgumentList, 604SyntaxKind.ElementAccessExpression => ((ElementAccessExpressionSyntax)expression).ArgumentList, 615case SyntaxKind.SimpleMemberAccessExpression: 618case SyntaxKind.InvocationExpression: 621if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 629case SyntaxKind.ElementAccessExpression: 632if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 663=> node.IsKind(SyntaxKind.ParenthesizedExpression); 673if (binaryExpression.Kind() is SyntaxKind.AsExpression or SyntaxKind.IsExpression && 720assignmentExpression.Kind() != SyntaxKind.LeftShiftAssignmentExpression && 721assignmentExpression.Kind() != SyntaxKind.RightShiftAssignmentExpression && 773if (newExpression.IsKind(SyntaxKind.ConditionalExpression) && 783if (newExpression.IsKind(SyntaxKind.SwitchExpression) && 793if (newExpression.IsKind(SyntaxKind.CollectionExpression) && 802if (newExpression.IsKind(SyntaxKind.TupleExpression) && 818if (originalExpression.IsKind(SyntaxKind.ConditionalExpression) && 819newExpression.IsKind(SyntaxKind.ConditionalExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TokenComparer.cs (4)
23x.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword && 24y.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (9)
38if (typeName?.FirstAncestorOrSelf<SyntaxNode>(a => a.Kind() is SyntaxKind.DeclarationExpression or SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement) is not { } declaration) 61Debug.Assert(node.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression); 84SyntaxKind.LocalDeclarationStatement or 85SyntaxKind.ForStatement or 86SyntaxKind.UsingStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (1)
104/// to var. <see cref="SyntaxFacts.IsPredefinedType(SyntaxKind)"/> considers string
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (4)
66declExpression.Designation.IsKind(SyntaxKind.ParenthesizedVariableDesignation)) 78if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (6)
104if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) }) 117if (!variableDeclaration.Type.IsKind(SyntaxKind.PointerType) && 248if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 252if (expression.IsKind(SyntaxKind.ImplicitObjectCreationExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeSyntaxComparer.cs (3)
47case SyntaxKind.ArrayType: 50case SyntaxKind.PointerType: 53case SyntaxKind.NullableType:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (5)
29.Select(n => n.GetTrailingTrivia().FirstOrNull(t => t.Kind() == SyntaxKind.EndOfLineTrivia)) 71var directive1IsUsingStatic = using1.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 72var directive2IsUsingStatic = using2.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 170if (!trailingTrivia.Any() || trailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia) 188=> node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.Kind() == SyntaxKind.EndOfLineTrivia));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1404)
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (8)
46if (node.Kind() is not SyntaxKind.MethodDeclaration and not SyntaxKind.PropertyDeclaration and not SyntaxKind.VariableDeclarator) 49if (node.IsKind(SyntaxKind.VariableDeclarator) && node is not { Parent.Parent: EventFieldDeclarationSyntax }) 81var xmlSpaceAfterTripleSlash = Token(leading: [DocumentationCommentExterior("///")], SyntaxKind.XmlTextLiteralToken, text: " ", valueText: " ", trailing: default); 85var xmlNewLineToken = Token(leading: default, SyntaxKind.XmlTextLiteralNewLineToken, text: newLine, valueText: newLine, trailing: default); 88kind: SyntaxKind.SingleLineDocumentationCommentTrivia, 107if (finalLeadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)])
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
66if (constructorInitializer.IsKind(SyntaxKind.BaseConstructorInitializer))
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
86parenthesizedExpression.GetAncestor<InterpolatedStringExpressionSyntax>()?.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (21)
136if (stringLiteral.Kind() is SyntaxKind.InterpolatedStringTextToken) 138if (stringLiteral.GetRequiredParent() is not InterpolatedStringTextSyntax { Parent: InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedMultiLineRawStringStartToken) } interpolatedString }) 143else if (stringLiteral.Kind() is SyntaxKind.InterpolatedRawStringEndToken) 145if (stringLiteral.GetRequiredParent() is not InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedMultiLineRawStringStartToken) } interpolatedString) 150else if (stringLiteral.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 228if (token.IsKind(SyntaxKind.HashToken) && token.Parent!.Kind() is not (SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia)) 287if (firstBodyToken.Kind() != SyntaxKind.EndOfFileToken 307if (leadingTrivia is [(kind: SyntaxKind.EndOfLineTrivia), ..]) 313if (leadingTrivia is [(kind: SyntaxKind.WhitespaceTrivia), (kind: SyntaxKind.EndOfLineTrivia), ..]) 350var originalHadTrailingNewLine = namespaceDeclaration.GetTrailingTrivia() is [.., (kind: SyntaxKind.EndOfLineTrivia)]; 358if (trailingTrivia is not [.., (kind: SyntaxKind.EndOfLineTrivia)]) 367(kind: SyntaxKind.EndOfLineTrivia or SyntaxKind.EndIfDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia), 368(kind: SyntaxKind.EndOfLineTrivia) 388if (openBraceToken.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 400if (!fileScopedNamespace.GetLastToken().GetNextTokenOrEndOfFile().IsKind(SyntaxKind.EndOfFileToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (5)
59var nodeToGenerate = (SyntaxKind)int.Parse(properties[Constants.NodeToGenerateKey]!); 99Debug.Assert(nextStatement.Kind() is SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement); 100editor.RemoveNode(nextStatement.IsParentKind(SyntaxKind.GlobalStatement) ? nextStatement.GetRequiredParent() : nextStatement);
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (17)
41SyntaxKind nodeToGenerate, 52var rewriter = new Rewriter(model, isAllThrowStatements: nodeToGenerate == SyntaxKind.ThrowStatement, cancellationToken); 68SyntaxKind nodeToGenerate, 73case SyntaxKind.ReturnStatement: 75Token(leadingTrivia, SyntaxKind.ReturnKeyword, trailing: default), 78case SyntaxKind.ThrowStatement: 80Token(leadingTrivia, SyntaxKind.ThrowKeyword, trailing: default), 93private ExpressionStatementSyntax GenerateAssignment(ExpressionSyntax switchExpression, SyntaxKind assignmentKind, SyntaxTriviaList leadingTrivia) 151totalPattern = BinaryPattern(SyntaxKind.OrPattern, totalPattern.Parenthesize(), nextPatternPart.Parenthesize()); 162case SyntaxKind.CasePatternSwitchLabel: 167case SyntaxKind.CaseSwitchLabel: 171case SyntaxKind.DefaultSwitchLabel: 208Debug.Assert(!statements[0].IsKind(SyntaxKind.BreakStatement)); 234if (nextStatement is (kind: SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement)) 250Token(leading: default, SyntaxKind.SwitchKeyword, node.CloseParenToken.TrailingTrivia), 251Token(leading: default, SyntaxKind.OpenBraceToken, node.OpenBraceToken.TrailingTrivia),
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (2)
65var invocationExpression = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.InvocationExpression)); 87if (!methodDeclaration.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (14)
37if (typeDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword)) 191SyntaxKind.ThisConstructorInitializer, 201=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.EqualsEqualsToken }); 203=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.ExclamationEqualsToken }); 418? SyntaxKind.RecordDeclaration 419: SyntaxKind.RecordStructDeclaration, 653SyntaxKind.MultiLineDocumentationCommentTrivia, 670SyntaxKind.MultiLineDocumentationCommentTrivia, 704if (docComment.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia)) 739if (prevToken.IsKind(SyntaxKind.XmlTextLiteralNewLineToken)) 796token.IsKind(SyntaxKind.XmlTextLiteralToken) 801tokens is [(kind: SyntaxKind.XmlTextLiteralNewLineToken), _, ..]) 811tokens is [.., (kind: SyntaxKind.XmlTextLiteralNewLineToken), (kind: SyntaxKind.XmlTextLiteralToken) textLiteral] &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (2)
414? SyntaxKind.NullLiteralExpression 415: SyntaxKind.DefaultLiteralExpression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
153SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), newNameNode).WithAdditionalAnnotations(Simplifier.Annotation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (1)
42var docCommentNodes = leadingTrivia.Where(f => f.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia));
src\roslyn\src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpRemoveDocCommentNodeCodeFixProvider.cs (2)
47=> token.Kind() == SyntaxKind.XmlTextLiteralToken && IsWhitespace(token.Text); 50=> token.Kind() == SyntaxKind.XmlTextLiteralNewLineToken;
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (5)
52if (firstTrivia.Kind() != SyntaxKind.SkippedTokensTrivia) 60return enumOrDelegateKeyword.Kind() is SyntaxKind.EnumKeyword or SyntaxKind.DelegateKeyword; 85var isEnumConstraint = enumOrDelegateKeyword.Kind() is SyntaxKind.EnumKeyword; 104SyntaxKind.StructConstraint)));
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (3)
58=> typeSyntax is PredefinedTypeSyntax { Keyword.RawKind: (int)SyntaxKind.VoidKeyword }; 144MethodDeclarationSyntax method => (method.ReturnType, method.Modifiers.Any(SyntaxKind.AsyncKeyword)), 147LocalFunctionStatementSyntax localFunction => (localFunction.ReturnType, localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword)),
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (2)
57typeToGenerateIn = constructorInitializer.IsKind(SyntaxKind.ThisConstructorInitializer) 188constructorDeclarationSyntax.Initializer.IsKind(SyntaxKind.ThisConstructorInitializer))
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (2)
46if (baseList.Parent is TypeDeclarationSyntax(SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration) parentTypeDecl &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateEnumMember\CSharpGenerateEnumMemberService.cs (4)
42is SyntaxKind.InvocationExpression 43or SyntaxKind.ObjectCreationExpression 44or SyntaxKind.GotoStatement 45or SyntaxKind.AliasQualifiedName)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateConversionCodeFixProvider.cs (4)
37is SyntaxKind.IdentifierName 38or SyntaxKind.MethodDeclaration 39or SyntaxKind.InvocationExpression 40or SyntaxKind.CastExpression ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (3)
46.FirstOrDefault(n => n.Kind() is SyntaxKind.SimpleAssignmentExpression or SyntaxKind.ForEachVariableStatement or SyntaxKind.PositionalPatternClause);
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateMethodCodeFixProvider.cs (4)
56is SyntaxKind.IdentifierName 57or SyntaxKind.MethodDeclaration 58or SyntaxKind.InvocationExpression 59or SyntaxKind.CastExpression ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (2)
66SyntaxKind.ImplicitKeyword, 92SyntaxKind.ImplicitKeyword,
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
109if (simpleNameOrMemberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression, out invocationExpressionOpt))
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (2)
35=> _invocationExpression.IsParentKind(SyntaxKind.RefExpression) ? RefKind.Ref : RefKind.None; 137=> State.SimpleNameOpt.Kind() == SyntaxKind.IdentifierName;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (4)
61SyntaxKind.ClassDeclaration or 62SyntaxKind.StructDeclaration or 63SyntaxKind.RecordDeclaration or 64SyntaxKind.RecordStructDeclaration) typeDeclaration)
src\roslyn\src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
96if (ifStatement.Parent.IsKind(SyntaxKind.ElseClause) && 151var expressionTriviaWithoutEndOfLine = expressionTrivia.Where(t => !t.IsKind(SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (2)
76SyntaxKind.YieldReturnStatement, 220node = ancestors.FirstOrDefault(n => n.Span.Contains(span) && n != root && n.IsKind(SyntaxKind.ReturnStatement));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
161syntaxEditor.ReplaceNode(name, MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName("@this"), name));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberStatic\CSharpMakeMemberStaticCodeFixProvider.cs (1)
31if (node.IsKind(SyntaxKind.VariableDeclarator) && node.Parent is VariableDeclarationSyntax { Parent: FieldDeclarationSyntax or EventFieldDeclarationSyntax })
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (2)
51return token.Kind() == SyntaxKind.IdentifierToken && token.Text == "await"; 192var partialModifier = modifiers.FirstOrDefault(static m => m.IsKind(SyntaxKind.PartialKeyword));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (3)
97SyntaxKind.ForEachStatement or 98SyntaxKind.ForEachVariableStatement or 99SyntaxKind.UsingStatement))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
77if (otherAccessor.Modifiers.Any(SyntaxKind.ReadOnlyKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeTypeAbstract\CSharpMakeTypeAbstractCodeFixProvider.cs (4)
50if (enclosingType?.Kind() is SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration && 51!enclosingType.Modifiers.Any(SyntaxKind.AbstractKeyword) && !enclosingType.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (2)
342.SkipWhile(trivia => trivia.All(t => t.IsWhitespaceOrEndOfLine()) && trivia.Last().IsKind(SyntaxKind.EndOfLineTrivia)) 376if (firstMemberTrivia is [(kind: SyntaxKind.EndOfLineTrivia), ..])
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
52Contract.ThrowIfTrue(arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
52Contract.ThrowIfTrue(questionToken.Kind() != SyntaxKind.QuestionToken);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (2)
68if (!token.IsKind(SyntaxKind.CloseBraceToken)) 75if (!firstBrace.IsKind(SyntaxKind.CloseBraceToken))
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
105return previousToken.TrailingTrivia.All(t => t.Kind() == SyntaxKind.WhitespaceTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (25)
66if (node.IsKind(SyntaxKind.ConditionalAccessExpression)) 116if (node.Parent is (kind: SyntaxKind.ReturnStatement or SyntaxKind.YieldReturnStatement)) 120SyntaxKind.MethodDeclaration or 121SyntaxKind.PropertyDeclaration or 122SyntaxKind.ParenthesizedLambdaExpression or 123SyntaxKind.SimpleLambdaExpression or 124SyntaxKind.LocalFunctionStatement or 125SyntaxKind.AnonymousMethodExpression or 126SyntaxKind.ConstructorDeclaration or 127SyntaxKind.DestructorDeclaration or 128SyntaxKind.OperatorDeclaration or 129SyntaxKind.IndexerDeclaration or 130SyntaxKind.EventDeclaration); 135var onYield = node.IsParentKind(SyntaxKind.YieldReturnStatement); 260if (node.IsParentKind(SyntaxKind.ArrowExpressionClause) && 271if (modifiers.Any(SyntaxKind.AsyncKeyword) || onYield) 316SyntaxKind.NullLiteralExpression or 317SyntaxKind.AsExpression or 318SyntaxKind.DefaultExpression or 319SyntaxKind.DefaultLiteralExpression or 320SyntaxKind.ConditionalExpression or 321SyntaxKind.ConditionalAccessExpression or 322SyntaxKind.PropertyDeclaration or 323SyntaxKind.VariableDeclarator;
src\roslyn\src\Analyzers\CSharp\CodeFixes\PopulateSwitch\CSharpPopulateSwitchExpressionCodeFixProvider.cs (1)
47insertLocation, newArms, SyntaxKind.CommaToken));
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (1)
35var asyncTokenIndex = modifiers.IndexOf(SyntaxKind.AsyncKeyword);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (4)
67Debug.Assert(node.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression); 75n => n.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (1)
53SyntaxKind.IsExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs (3)
81is not SyntaxKind.Block 82and not SyntaxKind.SwitchSection 83and not SyntaxKind.GlobalStatement)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (12)
48case SyntaxKind.IdentifierName: 52case SyntaxKind.VariableDeclarator: 71case SyntaxKind.SingleVariableDesignation: 76case SyntaxKind.CatchDeclaration: 80case SyntaxKind.VarPattern: 81return node.IsParentKind(SyntaxKind.Subpattern) 93if (newNameNode.IsKind(SyntaxKind.DiscardDesignation)) 212if (originalCompoundAssignment.Parent.IsKind(SyntaxKind.ExpressionStatement)) 214if (!originalCompoundAssignment.IsKind(SyntaxKind.CoalesceAssignmentExpression)) 225BinaryExpression(SyntaxKind.CoalesceExpression, leftOfAssignment, rightOfAssignment)); 231var mappedBinaryExpressionKind = originalCompoundAssignment.Kind().MapCompoundAssignmentKindToBinaryExpressionKind(); 232if (mappedBinaryExpressionKind == SyntaxKind.None)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
44token.IsKind(SyntaxKind.DefaultKeyword) && 45token.Parent is LiteralExpressionSyntax(SyntaxKind.DefaultLiteralExpression) defaultLiteral)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyInterpolation\CSharpSimplifyInterpolationCodeFixProvider.cs (1)
39if (interpolatedString.StringStartToken.Kind() == SyntaxKind.InterpolatedVerbatimStringStartToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorCodeFixProvider.cs (1)
52containingProperty.Modifiers.Any(SyntaxKind.PartialKeyword) &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
103return MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, outerExpression, innerName);
src\roslyn\src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (4)
45var skippedTriviaIndex = leadingTrivia.IndexOf(SyntaxKind.SkippedTokensTrivia); 54if (classOrStructKeyword.Kind() is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword) 60var trailingTriviaTakeUntil = remainingLeadingTrivia.IndexOf(SyntaxKind.EndOfLineTrivia) is >= 0 and var eolIndex
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (8)
51=> accessor.Kind() is SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration; 122var accessor = AccessorDeclaration(SyntaxKind.SetAccessorDeclaration).WithSemicolonToken(SemicolonToken); 129.WithModifiers(TokenList(updatedProperty.Modifiers.Where(token => !token.IsKind(SyntaxKind.ReadOnlyKeyword)))); 154var indentation = leadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia) whitespaceTrivia] 185=> attributeList.WithTarget(AttributeTargetSpecifier(Identifier(SyntaxFacts.GetText(SyntaxKind.FieldKeyword)), ColonToken.WithTrailingTrivia(Space))); 194AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) 203(isTrivialGetAccessor && accessor.Kind() is SyntaxKind.GetAccessorDeclaration) ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\SingleLinePropertyFormattingRule.cs (7)
16if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AccessorList)) 19if (previousToken.IsKind(SyntaxKind.OpenBraceToken) && previousToken.Parent.IsKind(SyntaxKind.AccessorList)) 22if (currentToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AccessorList)) 25if (previousToken.IsKind(SyntaxKind.SemicolonToken) && currentToken.Parent is AccessorDeclarationSyntax)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\UseAutoPropertyRewriter.cs (2)
26if (node.Expression.IsKind(SyntaxKind.ThisExpression)) 47Parent: InitializerExpressionSyntax { RawKind: (int)SyntaxKind.ObjectInitializerExpression }
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (6)
103SyntaxKind.CollectionInitializerExpression, 105[LiteralExpression(SyntaxKind.NullLiteralExpression, NullKeyword.WithAdditionalAnnotations(nullTokenAnnotation))], 129if (nodesAndTokens.Count > 0 && nodesAndTokens.Last().GetTrailingTrivia() is [.., (kind: not SyntaxKind.EndOfLineTrivia)]) 549SyntaxKind.SimpleMemberAccessExpression, 674if (token.LeadingTrivia is not [.., (kind: SyntaxKind.WhitespaceTrivia)]) 925while (index - 1 >= 0 && trivia[index - 1].Kind() == SyntaxKind.WhitespaceTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs (1)
23SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
80if (addLineBreak && item.GetTrailingTrivia() is not [.., (kind: SyntaxKind.EndOfLineTrivia)]) 134SyntaxKind.ComplexElementInitializerExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (11)
20: AbstractUseCompoundAssignmentCodeFixProvider<SyntaxKind, AssignmentExpressionSyntax, ExpressionSyntax>(Utilities.Kinds) 22protected override SyntaxToken Token(SyntaxKind kind) 26SyntaxKind assignmentOpKind, ExpressionSyntax left, SyntaxToken syntaxToken, ExpressionSyntax right) 33? Postfix(SyntaxKind.PostIncrementExpression, left) 34: Prefix(SyntaxKind.PreIncrementExpression, left); 38? Postfix(SyntaxKind.PostDecrementExpression, left) 39: Prefix(SyntaxKind.PreDecrementExpression, left); 41private static ExpressionSyntax Postfix(SyntaxKind kind, ExpressionSyntax operand) 44private static ExpressionSyntax Prefix(SyntaxKind kind, ExpressionSyntax operand) 47protected override SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia) => initialTrivia.SkipWhile(el => el.Kind() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia).ToSyntaxTriviaList();
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (2)
60SyntaxKind.CoalesceAssignmentExpression, 107SyntaxKind.CoalesceAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\MultiLineConditionalExpressionFormattingRule.cs (2)
34=> token.Kind() is SyntaxKind.QuestionToken or SyntaxKind.ColonToken && token.GetRequiredParent().HasAnnotation(SpecializedFormattingAnnotation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
138SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
59SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression).WithTriviaFrom(defaultExpression)),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
134a => a.Expression.Kind() != SyntaxKind.DefaultLiteralExpression && Equals(arrayElementType, semanticModel.GetTypeInfo(a.Expression).Type)); 152SyntaxKind.SimpleMemberAccessExpression, 166SyntaxKind.ArrayInitializerExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (4)
200case SyntaxKind.SingleVariableDesignation: 206case SyntaxKind.DiscardDesignation: 210case SyntaxKind.ParenthesizedVariableDesignation: 225var separatorBuilder = ArrayBuilder<SyntaxToken>.GetInstance(builder.Count - 1, Token(leading: default, SyntaxKind.CommaToken, trailing: default));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\Helpers.cs (1)
17SyntaxKind.IndexExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseInterpolatedVerbatimString\CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (1)
54var newStartToken = SyntaxFactory.Token(oldStartToken.LeadingTrivia, SyntaxKind.InterpolatedVerbatimStringStartToken,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (3)
68if (binary.IsKind(SyntaxKind.EqualsExpression)) 81SyntaxKind.IsExpression, 88=> binary.Right.IsKind(SyntaxKind.NullLiteralExpression)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider.cs (3)
25= LiteralExpression(SyntaxKind.NullLiteralExpression); 34=> BinaryExpression(SyntaxKind.EqualsExpression, argument, s_nullLiteralExpression).Parenthesize(); 52SyntaxKind.IsExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs (1)
26private static readonly ConstantPatternSyntax s_nullConstantPattern = ConstantPattern(LiteralExpression(SyntaxKind.NullLiteralExpression));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
212if (anonymousFunction.AsyncKeyword.IsKind(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
21SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (1)
29SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (3)
28var initializerKind = firstExpression is AssignmentExpressionSyntax 29? SyntaxKind.ObjectInitializerExpression 30: SyntaxKind.CollectionInitializerExpression;
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (12)
36private static SyntaxKind MapToSyntaxKind(BinaryOperatorKind kind) 40BinaryOperatorKind.LessThan => SyntaxKind.LessThanToken, 41BinaryOperatorKind.GreaterThan => SyntaxKind.GreaterThanToken, 42BinaryOperatorKind.LessThanOrEqual => SyntaxKind.LessThanEqualsToken, 43BinaryOperatorKind.GreaterThanOrEqual => SyntaxKind.GreaterThanEqualsToken, 93p.IsDisjunctive ? SyntaxKind.OrPattern : SyntaxKind.AndPattern, 95Token(p.Token.LeadingTrivia, p.IsDisjunctive ? SyntaxKind.OrKeyword : SyntaxKind.AndKeyword, 115if (unwrapped is UnaryPatternSyntax(SyntaxKind.NotPattern) unaryPattern) 129if (expr.IsKind(SyntaxKind.DefaultLiteralExpression)) 133if (expr.IsKind(SyntaxKind.NullLiteralExpression))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (7)
123if (isPatternExpression.Pattern is UnaryPatternSyntax(kind: SyntaxKind.NotPattern) unaryPattern && 137SyntaxKind.EqualsExpression => ConstantPattern(binaryExpression.Right), 139SyntaxKind.NotEqualsExpression => UnaryPattern(ConstantPattern(binaryExpression.Right)), 142SyntaxKind.GreaterThanExpression or 143SyntaxKind.GreaterThanOrEqualExpression or 144SyntaxKind.LessThanExpression or 145SyntaxKind.LessThanOrEqualExpression => RelationalPattern(binaryExpression.OperatorToken, binaryExpression.Right),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (3)
168if (comparison.Kind() is not (SyntaxKind.EqualsExpression or SyntaxKind.IsPatternExpression)) 179return PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, isPatternExpression.Parenthesize());
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
88newIf = originalIf.IsParentKind(SyntaxKind.ElseClause)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (7)
42Matcher.Single<SyntaxTrivia>(t => t.Kind() == SyntaxKind.EndOfLineTrivia, "first end of line"), 43Matcher.Repeat(Matcher.Single<SyntaxTrivia>(t => t.Kind() == SyntaxKind.WhitespaceTrivia, "whitespace")), 44Matcher.Single<SyntaxTrivia>(t => t.IsKind(SyntaxKind.EndOfLineTrivia), "second end of line")); 265var inKeyword = current.Modifiers.FirstOrDefault(t => t.Kind() == SyntaxKind.InKeyword); 334: MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, containingTypeSyntax, currentName); 374=> node.GetLeadingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia) whitespace] ? whitespace.ToString() : ""; 550=> memberDeclaration.GetLeadingTrivia().Any(t => t.GetStructure()?.Kind() == SyntaxKind.PragmaWarningDirectiveTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (3)
132var insertionIndex = leadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)] 159SyntaxKind.SingleLineDocumentationCommentTrivia, 220Trivia(DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia, [.. allContent])));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
147.Any(SyntaxKind.EndOfLineTrivia);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (1)
59SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
63if (current.Arguments.Any(a => a.Kind() != SyntaxKind.OmittedTypeArgument))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (3)
161if (argument.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken) 202SyntaxKind.SimpleMemberAccessExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (3)
95var kind = CodeGenerationConstructorInfo.GetThisConstructorArgumentsOpt(constructor) != null 96? SyntaxKind.ThisConstructorInitializer 97: SyntaxKind.BaseConstructorInitializer;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (12)
95if (t1.Kind() == SyntaxKind.MultiLineCommentTrivia) 100return SyntaxTrivia(SyntaxKind.MultiLineCommentTrivia, text + MultiLineCommentTerminator); 103else if (t1.Kind() == SyntaxKind.SkippedTokensTrivia) 196=> declaration.ChildTokens().Where(t => t.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CloseBraceToken && t.IsMissing).Any(); 233SyntaxKind.ClassDeclaration => CodeGenerationDestination.ClassType, 234SyntaxKind.CompilationUnit => CodeGenerationDestination.CompilationUnit, 235SyntaxKind.EnumDeclaration => CodeGenerationDestination.EnumType, 236SyntaxKind.InterfaceDeclaration => CodeGenerationDestination.InterfaceType, 237SyntaxKind.FileScopedNamespaceDeclaration => CodeGenerationDestination.Namespace, 238SyntaxKind.NamespaceDeclaration => CodeGenerationDestination.Namespace, 239SyntaxKind.StructDeclaration => CodeGenerationDestination.StructType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (20)
457ComputePositionAndTriviaForRemoveAttributeList(attributeList, t => t.IsKind(SyntaxKind.EndOfLineTrivia), out positionOfRemovedNode, out trivia); 463ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, t => t.IsKind(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia); 511var insertionIndex = compilationUnit.Members.LastIndexOf(memberDeclaration => memberDeclaration.IsKind(SyntaxKind.GlobalStatement)) + 1; 515else if (destinationMember is StatementSyntax statement && statement.IsParentKind(SyntaxKind.GlobalStatement)) 786case SyntaxKind.DelegateDeclaration: 794case SyntaxKind.MethodDeclaration: 802case SyntaxKind.OperatorDeclaration: 810case SyntaxKind.ConversionOperatorDeclaration: 818case SyntaxKind.PropertyDeclaration: 826case SyntaxKind.EventDeclaration: 834case SyntaxKind.IndexerDeclaration: 842case SyntaxKind.Parameter: 856case SyntaxKind.IncompleteMember: 870case SyntaxKind.ArrayType: 878case SyntaxKind.PointerType: 886case SyntaxKind.VariableDeclaration: 894case SyntaxKind.CatchDeclaration: 918case SyntaxKind.CompilationUnit: 919case SyntaxKind.NamespaceDeclaration: 920case SyntaxKind.FileScopedNamespaceDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (78)
15private static readonly Dictionary<SyntaxKind, int> s_kindPrecedenceMap = new(SyntaxFacts.EqualityComparer) 17{ SyntaxKind.FieldDeclaration, 0 }, 18{ SyntaxKind.ConstructorDeclaration, 1 }, 19{ SyntaxKind.DestructorDeclaration, 2 }, 20{ SyntaxKind.IndexerDeclaration, 3 }, 21{ SyntaxKind.PropertyDeclaration, 4 }, 22{ SyntaxKind.EventFieldDeclaration, 5 }, 23{ SyntaxKind.EventDeclaration, 6 }, 24{ SyntaxKind.MethodDeclaration, 7 }, 25{ SyntaxKind.OperatorDeclaration, 8 }, 26{ SyntaxKind.ConversionOperatorDeclaration, 9 }, 27{ SyntaxKind.EnumDeclaration, 10 }, 28{ SyntaxKind.InterfaceDeclaration, 11 }, 29{ SyntaxKind.StructDeclaration, 12 }, 30{ SyntaxKind.ClassDeclaration, 13 }, 31{ SyntaxKind.RecordDeclaration, 14 }, 32{ SyntaxKind.RecordStructDeclaration, 15 }, 33{ SyntaxKind.DelegateDeclaration, 16 } 36private static readonly Dictionary<SyntaxKind, int> s_operatorPrecedenceMap = new(SyntaxFacts.EqualityComparer) 38{ SyntaxKind.PlusToken, 0 }, 39{ SyntaxKind.MinusToken, 1 }, 40{ SyntaxKind.ExclamationToken, 2 }, 41{ SyntaxKind.TildeToken, 3 }, 42{ SyntaxKind.PlusPlusToken, 4 }, 43{ SyntaxKind.MinusMinusToken, 5 }, 44{ SyntaxKind.AsteriskToken, 6 }, 45{ SyntaxKind.SlashToken, 7 }, 46{ SyntaxKind.PercentToken, 8 }, 47{ SyntaxKind.AmpersandToken, 9 }, 48{ SyntaxKind.BarToken, 10 }, 49{ SyntaxKind.CaretToken, 11 }, 50{ SyntaxKind.LessThanLessThanToken, 12 }, 51{ SyntaxKind.GreaterThanGreaterThanToken, 13 }, 52{ SyntaxKind.EqualsEqualsToken, 14 }, 53{ SyntaxKind.ExclamationEqualsToken, 15 }, 54{ SyntaxKind.LessThanToken, 16 }, 55{ SyntaxKind.GreaterThanToken, 17 }, 56{ SyntaxKind.LessThanEqualsToken, 18 }, 57{ SyntaxKind.GreaterThanEqualsToken, 19 }, 58{ SyntaxKind.TrueKeyword, 20 }, 59{ SyntaxKind.FalseKeyword, 21 }, 60{ SyntaxKind.GreaterThanGreaterThanGreaterThanToken, 22 }, 103case SyntaxKind.DelegateDeclaration: 106case SyntaxKind.FieldDeclaration: 107case SyntaxKind.EventFieldDeclaration: 110case SyntaxKind.ConstructorDeclaration: 113case SyntaxKind.DestructorDeclaration: 117case SyntaxKind.MethodDeclaration: 120case SyntaxKind.OperatorDeclaration: 123case SyntaxKind.EventDeclaration: 126case SyntaxKind.IndexerDeclaration: 129case SyntaxKind.PropertyDeclaration: 132case SyntaxKind.EnumDeclaration: 135case SyntaxKind.InterfaceDeclaration: 136case SyntaxKind.StructDeclaration: 137case SyntaxKind.RecordStructDeclaration: 138case SyntaxKind.ClassDeclaration: 139case SyntaxKind.RecordDeclaration: 142case SyntaxKind.ConversionOperatorDeclaration: 145case SyntaxKind.IncompleteMember: 148case SyntaxKind.GlobalStatement: 217return x.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword ? -1 : 1; 301private static bool ContainsToken(SyntaxTokenList list, SyntaxKind kind) 316if (ContainsToken(modifiers, SyntaxKind.PublicKeyword)) 320else if (ContainsToken(modifiers, SyntaxKind.ProtectedKeyword)) 322if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 327if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 334else if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 338else if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 347if (node.Kind() == SyntaxKind.InterfaceDeclaration) 352else if (node.Kind() is SyntaxKind.StructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration) 362private static bool BothHaveModifier(SyntaxTokenList x, SyntaxTokenList y, SyntaxKind modifierKind, out int comparisonResult) 378=> BothHaveModifier(x, y, SyntaxKind.StaticKeyword, out comparisonResult); 381=> BothHaveModifier(x, y, SyntaxKind.ConstKeyword, out comparisonResult); 384=> BothHaveModifier(x, y, SyntaxKind.ReadOnlyKeyword, out comparisonResult);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (9)
34else if (members.LastOrDefault().Kind() == SyntaxKind.CommaToken) 118if (lastExpression.Kind() == SyntaxKind.LeftShiftExpression && 122if (binaryExpression.Left.Kind() == SyntaxKind.NumericLiteralExpression) 132SyntaxKind.LeftShiftExpression, 133LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(numericLiteral.Token.Text, 1)), 134LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(shiftValue.ToString(), shiftValue))); 138else if (lastExpression is LiteralExpressionSyntax(SyntaxKind.NumericLiteralExpression) numericLiteral) 146return LiteralExpression(SyntaxKind.NumericLiteralExpression, 151return LiteralExpression(SyntaxKind.NumericLiteralExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (7)
28if (eventDeclaration.Kind() == SyntaxKind.EventFieldDeclaration) 36if (eventDeclaration.Kind() == SyntaxKind.EventDeclaration) 53if (eventDeclaration.Kind() == SyntaxKind.FieldDeclaration) 164GenerateAccessorDeclaration(@event, @event.AddMethod, SyntaxKind.AddAccessorDeclaration, destination, info), 165GenerateAccessorDeclaration(@event, @event.RemoveMethod, SyntaxKind.RemoveAccessorDeclaration, destination, info), 174SyntaxKind kind, 186SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (18)
42InitializerExpression(SyntaxKind.ArrayInitializerExpression, 51=> LiteralExpression(SyntaxKind.NullLiteralExpression); 108? SyntaxKind.TrueLiteralExpression 109: SyntaxKind.FalseLiteralExpression); 116SyntaxKind.StringLiteralExpression, Literal(valueString, val)); 123SyntaxKind.CharacterLiteralExpression, Literal(literal, val)); 186return BinaryExpression(SyntaxKind.DivideExpression, 192return BinaryExpression(SyntaxKind.DivideExpression, 198return BinaryExpression(SyntaxKind.DivideExpression, 199PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateDoubleLiteralExpression(null, 1.0, false)), 215return BinaryExpression(SyntaxKind.DivideExpression, 221return BinaryExpression(SyntaxKind.DivideExpression, 227return BinaryExpression(SyntaxKind.DivideExpression, 228PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateSingleLiteralExpression(null, 1.0F, false)), 279SyntaxKind.NumericLiteralExpression, tokenFactory(stringValue, nonNegativeValue)); 282? PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, literal) 299var result = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, memberAccess, IdentifierName(constant.Value)); 315: MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, result, name);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (6)
28.Where(f => f.Modifiers.Any(SyntaxKind.ConstKeyword)) 33if (fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword)) 39.Where(f => f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)) 43.Where(f => !f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword) && !f.Modifiers.Any(SyntaxKind.ConstKeyword)) 48return fieldDeclaration.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (2)
26private static readonly TypeParameterConstraintSyntax s_classConstraint = ClassOrStructConstraint(SyntaxKind.ClassConstraint); 27private static readonly TypeParameterConstraintSyntax s_structConstraint = ClassOrStructConstraint(SyntaxKind.StructConstraint);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (14)
168case SyntaxKind.EnumDeclaration: 171case SyntaxKind.StructDeclaration: 172case SyntaxKind.RecordStructDeclaration: 173case SyntaxKind.InterfaceDeclaration: 174case SyntaxKind.ClassDeclaration: 175case SyntaxKind.RecordDeclaration: 201var declarationKind = isRecordClass ? SyntaxKind.RecordDeclaration : SyntaxKind.RecordStructDeclaration; 202var classOrStructKeyword = Token(isRecordClass ? default : SyntaxKind.StructKeyword); 211var kind = namedType.TypeKind == TypeKind.Struct ? SyntaxKind.StructDeclaration : 212namedType.TypeKind == TypeKind.Interface ? SyntaxKind.InterfaceDeclaration : SyntaxKind.ClassDeclaration;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (2)
82var operatorSyntaxKind = SyntaxFacts.GetOperatorKind(method.MetadataName); 83if (operatorSyntaxKind == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (8)
185if (accessor.IsKind(SyntaxKind.GetAccessorDeclaration)) 252SyntaxKind declarationKind, AccessorDeclarationSyntax accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference, CancellationToken cancellationToken, 279var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 282GenerateAccessorDeclaration(property, property.GetMethod, SyntaxKind.GetAccessorDeclaration, destination, info, cancellationToken), 294SyntaxKind kind, 308SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (7)
164case SyntaxKind.IdentifierName: 165case SyntaxKind.GenericName: 169case SyntaxKind.SimpleMemberAccessExpression: 170case SyntaxKind.PointerMemberAccessExpression: 174case SyntaxKind.SimpleLambdaExpression: 175case SyntaxKind.ParenthesizedLambdaExpression: 176case SyntaxKind.AnonymousMethodExpression:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\BasePropertyDeclarationSyntaxExtensions.cs (4)
21case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).SemicolonToken; 22case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).SemicolonToken; 39case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).WithSemicolonToken(semicolonToken); 40case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).WithSemicolonToken(semicolonToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (4)
130Debug.Assert(!endOfLine.IsKind(SyntaxKind.None)); 131if (!endOfLine.IsKind(SyntaxKind.None)) 150if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.IfDirectiveTrivia))) 155if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.EndIfDirectiveTrivia)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (42)
48public readonly ISet<SyntaxKind> PrecedingModifiers; 111ISet<SyntaxKind> precedingModifiers, 213targetToken.IsKind(SyntaxKind.TildeToken) && 214targetToken.Parent.IsKind(SyntaxKind.DestructorDeclaration) && 215targetToken.Parent.Parent is (kind: SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration); 224var isOnArgumentListBracketOrComma = targetToken.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList or SyntaxKind.ArrayRankSpecifier); 246isCrefContext: syntaxTree.IsCrefContext(position, cancellationToken) && !leftToken.IsKind(SyntaxKind.DotToken), 263isTaskLikeTypeContext: precedingModifiers.Contains(SyntaxKind.AsyncKeyword), 312if (token.Kind() == SyntaxKind.OpenBracketToken && 313token.Parent.IsKind(SyntaxKind.AttributeList) && 324ISet<SyntaxKind>? validModifiers = null, 325ISet<SyntaxKind>? validTypeDeclarations = null, 332public bool IsRecordDeclarationContext(ISet<SyntaxKind> validModifiers, CancellationToken cancellationToken) 336if (!previousToken.IsKind(SyntaxKind.RecordKeyword)) 346ISet<SyntaxKind> validTypeDeclarations, bool includingRecordParameters, CancellationToken cancellationToken) 352if (token.Kind() == SyntaxKind.OpenBracketToken && 353token.Parent.IsKind(SyntaxKind.AttributeList)) 376if (token.Kind() == SyntaxKind.OpenBracketToken && 377token.Parent.IsKind(SyntaxKind.AttributeList) && 392if (token.Kind() == SyntaxKind.OpenBracketToken && 393token.Parent.IsKind(SyntaxKind.AttributeList) && 403ISet<SyntaxKind>? validModifiers = null, 404ISet<SyntaxKind>? validTypeDeclarations = null, 439if (targetToken.IsKind(SyntaxKind.AwaitKeyword)) 450&& targetToken.IsKind(SyntaxKind.IdentifierToken) 451&& targetToken.HasMatchingText(SyntaxKind.AwaitKeyword)) 483if (node.IsKind(SyntaxKind.QueryExpression)) 487if (targetToken.IsKind(SyntaxKind.InKeyword)) 534SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword => AttributeTargets.Assembly | AttributeTargets.Module, 535SyntaxKind.TypeKeyword => AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, 536SyntaxKind.MethodKeyword => AttributeTargets.Method, 537SyntaxKind.FieldKeyword => AttributeTargets.Field, 538SyntaxKind.PropertyKeyword => AttributeTargets.Property, 539SyntaxKind.EventKeyword => AttributeTargets.Event, 540SyntaxKind.ParamKeyword => AttributeTargets.Parameter, 541SyntaxKind.ReturnKeyword => AttributeTargets.ReturnValue, 542SyntaxKind.TypeVarKeyword => AttributeTargets.GenericParameter, 555RecordDeclarationSyntax record => record.ClassOrStructKeyword.IsKind(SyntaxKind.StructKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (114)
19token.Kind() is SyntaxKind.UsingKeyword or 20SyntaxKind.ExternKeyword; 25if (token.IsKind(SyntaxKind.UsingKeyword)) 41if (token is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 47if (token.IsKind(SyntaxKind.UnsafeKeyword) && 48token.GetPreviousToken() is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 115case SyntaxKind.OpenBraceToken when token.Parent.IsKind(SyntaxKind.Block): 118case SyntaxKind.SemicolonToken: 120return statement != null && !statement.IsParentKind(SyntaxKind.GlobalStatement) && 123case SyntaxKind.CloseBraceToken: 124if (token.Parent.IsKind(SyntaxKind.Block)) 135if (token.Parent.Parent.Kind() is not SyntaxKind.TryStatement and not SyntaxKind.DoStatement) 139is SyntaxKind.ElseClause 140or SyntaxKind.FinallyClause 141or SyntaxKind.CatchClause 142or SyntaxKind.SwitchSection) 148if (token.Parent.IsKind(SyntaxKind.SwitchStatement)) 155case SyntaxKind.ColonToken: 156return token.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel or SyntaxKind.LabeledStatement); 158case SyntaxKind.DoKeyword when token.Parent.IsKind(SyntaxKind.DoStatement): 161case SyntaxKind.CloseParenToken: 164is SyntaxKind.ForStatement 165or SyntaxKind.ForEachStatement 166or SyntaxKind.ForEachVariableStatement 167or SyntaxKind.WhileStatement 168or SyntaxKind.IfStatement 169or SyntaxKind.LockStatement 170or SyntaxKind.UsingStatement 171or SyntaxKind.FixedStatement; 173case SyntaxKind.ElseKeyword: 174return token.Parent.IsKind(SyntaxKind.ElseClause); 176case SyntaxKind.CloseBracketToken: 177if (token.Parent.IsKind(SyntaxKind.AttributeList)) 207if (token.Kind() == SyntaxKind.CloseBraceToken) 211memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 217if (token.Kind() == SyntaxKind.SemicolonToken) 230memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 250if (token.Kind() == SyntaxKind.CloseBracketToken) 259if (token.Parent.IsKind(SyntaxKind.AttributeList)) 272if (token.Kind() == SyntaxKind.CloseParenToken) 274if (token.Parent.IsKind(SyntaxKind.CastExpression)) 300if (token.Kind() == SyntaxKind.IdentifierToken && 301token.GetPreviousToken(includeSkipped: true).Kind() == SyntaxKind.IntoKeyword) 326if (targetToken.Kind() is SyntaxKind.IfKeyword or 327SyntaxKind.ElifKeyword) 333if (targetToken.Kind() == SyntaxKind.OpenParenToken && 334targetToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 363if (targetToken.Kind() is not (SyntaxKind.IdentifierToken or SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken)) 395if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 396targetToken.Parent.IsKind(SyntaxKind.SwitchStatement)) 401if (targetToken.Kind() == SyntaxKind.ColonToken) 403if (targetToken.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel)) 409if (targetToken.Kind() is SyntaxKind.SemicolonToken or 410SyntaxKind.CloseBraceToken) 430return targetToken.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken && 431targetToken.Parent is (kind: SyntaxKind.CrefBracketedParameterList or SyntaxKind.CrefParameterList); 449if (targetToken.Kind() == SyntaxKind.ColonToken && 450targetToken.Parent.IsKind(SyntaxKind.NameColon) && 451targetToken.Parent.Parent.IsKind(SyntaxKind.Argument) && 452targetToken.Parent.Parent.Parent.IsKind(SyntaxKind.ArgumentList)) 456is SyntaxKind.InvocationExpression 457or SyntaxKind.ObjectCreationExpression 458or SyntaxKind.BaseConstructorInitializer 459or SyntaxKind.ThisConstructorInitializer) 465if (targetToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 467if (targetToken.Parent.IsKind(SyntaxKind.ArgumentList)) 470is SyntaxKind.ObjectCreationExpression 471or SyntaxKind.BaseConstructorInitializer 472or SyntaxKind.ThisConstructorInitializer) 480if (targetToken.Parent.IsParentKind(SyntaxKind.InvocationExpression) && !targetToken.IsInvocationOfVarExpression()) 492if (targetToken.Kind() == SyntaxKind.OperatorKeyword && 504targetToken.GetAncestors<StatementSyntax>().Any(s => s.IsKind(SyntaxKind.UnsafeStatement)) || 505targetToken.GetAncestors<MemberDeclarationSyntax>().Any(m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword) || 506targetToken.GetAncestors<LocalFunctionStatementSyntax>().Any(f => f.GetModifiers().Any(SyntaxKind.UnsafeKeyword))) || 507targetToken.GetAncestors<UsingDirectiveSyntax>().Any(d => d.UnsafeKeyword.IsKind(SyntaxKind.UnsafeKeyword)); 515return targetToken.IsKindOrHasMatchingText(SyntaxKind.YieldKeyword); 518public static bool IsAnyAccessorDeclarationContext(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 525public static bool IsAccessorDeclarationContext<TMemberNode>(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 545if (existingAccessor.Kind() != SyntaxKind.None) 569while (targetToken.Kind() is SyntaxKind.InternalKeyword or 570SyntaxKind.PublicKeyword or 571SyntaxKind.ProtectedKeyword or 572SyntaxKind.PrivateKeyword or 573SyntaxKind.ReadOnlyKeyword) 580if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 581targetToken.Parent.IsKind(SyntaxKind.AccessorList)) 588if (targetToken.Kind() == SyntaxKind.CloseBraceToken && 589targetToken.Parent.IsKind(SyntaxKind.Block) && 596if (targetToken.Kind() == SyntaxKind.SemicolonToken && 603if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 604targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 615if (node.IsKind(SyntaxKind.TypeParameterList)) 617if (node?.Parent is TypeDeclarationSyntax(SyntaxKind.InterfaceDeclaration) typeDecl) 636if (targetToken.Kind() == SyntaxKind.LessThanToken && 642if (targetToken.Kind() == SyntaxKind.CommaToken && 648if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 649targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 650targetToken.Parent.Parent.IsKind(SyntaxKind.TypeParameter) && 661if (token.Kind() == SyntaxKind.CommaToken && token.Parent is BaseArgumentListSyntax)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (444)
21private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.ExternKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.AsyncKeyword, 26SyntaxKind.UnsafeKeyword, 36if (token.IsKind(SyntaxKind.OpenBracketToken) && 37token.Parent.IsKind(SyntaxKind.AttributeList)) 44if (token.IsKind(SyntaxKind.CommaToken) && 45token.Parent.IsKind(SyntaxKind.AttributeList)) 52if (token.IsKind(SyntaxKind.ColonToken) && 53token.Parent.IsKind(SyntaxKind.AttributeTargetSpecifier)) 60if (token.Parent.IsKind(SyntaxKind.QualifiedName) && 61token.Parent.IsParentKind(SyntaxKind.Attribute)) 68if (token.Parent.IsKind(SyntaxKind.AliasQualifiedName) && 69token.Parent.IsParentKind(SyntaxKind.Attribute)) 80ISet<SyntaxKind> validModifiers, 95if (token.IsKind(SyntaxKind.CloseBracketToken) 115if (parent.IsKind(SyntaxKind.CompilationUnit) || 116(parent is MemberDeclarationSyntax && parent.IsParentKind(SyntaxKind.CompilationUnit))) 129return kind is ((int)SyntaxKind.AssemblyKeyword) 130or ((int)SyntaxKind.ModuleKeyword); 166if (token.IsKind(SyntaxKind.OpenBraceToken)) 177if (token.IsKind(SyntaxKind.SemicolonToken)) 194if (token.IsKind(SyntaxKind.CloseBraceToken)) 208token.Parent.IsKind(SyntaxKind.Block) && 220if (token.IsKind(SyntaxKind.CloseBracketToken) && 221token.Parent.IsKind(SyntaxKind.AttributeList)) 243ISet<SyntaxKind>? validModifiers, 244ISet<SyntaxKind>? validTypeDeclarations, 257validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 285token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 294validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 299if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 322SyntaxKind otherModifier, 330return modifierTokens.Contains(otherModifier) && IsLambdaDeclarationContext(syntaxTree, position, SyntaxKind.None, cancellationToken); 342ISet<SyntaxKind> validModifiers, 359if (token.Kind() == SyntaxKind.CloseBracketToken && token.Parent is AttributeListSyntax) 420(nextToken.Kind() == SyntaxKind.GlobalKeyword && nextToken.GetAncestor<UsingDirectiveSyntax>()?.GlobalKeyword == nextToken)) 426if (token.IsKind(SyntaxKind.None)) 440if (token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent is NamespaceDeclarationSyntax or TypeDeclarationSyntax) 455if (token.IsKind(SyntaxKind.SemicolonToken)) 457if (token.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective)) 477if (token.IsKind(SyntaxKind.CloseBraceToken)) 483else if (token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 492token.Parent.IsKind(SyntaxKind.Block) && 507if (token.IsKind(SyntaxKind.CloseBracketToken) && 508token.Parent.IsKind(SyntaxKind.AttributeList)) 511if (token.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 532ISet<SyntaxKind>? validModifiers, 533ISet<SyntaxKind>? validTypeDeclarations, 543validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 576token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 591validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 602return incompleteMember.Type.IsKind(SyntaxKind.RefType); 609if (modifierTokens.Contains(SyntaxKind.FileKeyword)) 612if (modifierTokens.Contains(SyntaxKind.ClosedKeyword)) 638if (token.IsKind(SyntaxKind.ColonColonToken) && 639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.GlobalKeyword)) 651if (token.IsKind(SyntaxKind.UsingKeyword)) 656if (token.GetNextToken(includeSkipped: true).Kind() != SyntaxKind.EqualsToken && 701is SyntaxKind.ClassKeyword 702or SyntaxKind.StructKeyword 703or SyntaxKind.InterfaceKeyword && 704token.GetPreviousToken().IsKind(SyntaxKind.PartialKeyword)) 737syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 738syntaxTree.IsAfterKeyword(position, SyntaxKind.RefKeyword, cancellationToken) || 739syntaxTree.IsAfterKeyword(position, SyntaxKind.ReadOnlyKeyword, cancellationToken) || 740syntaxTree.IsAfterKeyword(position, SyntaxKind.CaseKeyword, cancellationToken) || 741syntaxTree.IsAfterKeyword(position, SyntaxKind.EventKeyword, cancellationToken) || 742syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) || 785if (token.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken && 801if (token.IsKind(SyntaxKind.EqualsToken) && 831if (token.IsKind(SyntaxKind.WhereKeyword) && 832token.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 837if (token.IsKind(SyntaxKind.IdentifierToken) && 838token.HasMatchingText(SyntaxKind.WhereKeyword) && 839token.Parent.IsKind(SyntaxKind.IdentifierName) && 840token.Parent.IsParentKind(SyntaxKind.SimpleBaseType) && 841token.Parent.Parent.IsParentKind(SyntaxKind.BaseList)) 858if (token.IsKind(SyntaxKind.ColonToken) && 859token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IdentifierToken) && 860token.GetPreviousToken(includeSkipped: true).GetPreviousToken().IsKind(SyntaxKind.WhereKeyword)) 884if (token.IsKind(SyntaxKind.CommaToken) && 903if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.TypeOfExpression)) 915if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.DefaultExpression)) 928if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.SizeOfExpression)) 947case SyntaxKind.LessThanToken: 948case SyntaxKind.CommaToken: 949return token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList); 955{ Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } => true, 957{ Parent: TypeSyntax { Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } } => true, 963=> targetToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause) && 964targetToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken; 980if (token.Kind() is not SyntaxKind.LessThanToken and not SyntaxKind.CommaToken) 1015if (name.IsParentKind(SyntaxKind.LessThanExpression) && 1017conditional.IsParentKind(SyntaxKind.ExpressionStatement) && 1018conditional.Parent.IsParentKind(SyntaxKind.GlobalStatement)) 1060out SyntaxKind previousModifier) 1069previousModifier = SyntaxKind.None; 1071if (token.IsKind(SyntaxKind.OpenParenToken) && 1079if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 1085if (token.IsKind(SyntaxKind.CommaToken) && 1095if (token.IsKind(SyntaxKind.CommaToken) && 1104if (token.IsKind(SyntaxKind.CloseBracketToken) && 1105token.Parent.IsKind(SyntaxKind.AttributeList) && 1115if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.ReadOnlyKeyword or SyntaxKind.OutKeyword or SyntaxKind.ThisKeyword or SyntaxKind.ParamsKeyword or SyntaxKind.ScopedKeyword) 1120else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName }) 1123previousModifier = SyntaxKind.ScopedKeyword; 1150if (syntaxTree.IsParameterModifierContext(position, tokenOnLeftOfPosition, includeOperators: false, out _, out var previousModifier) && 1151previousModifier == SyntaxKind.None) 1164if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken) 1166return token.Parent.IsKind(SyntaxKind.BracketedParameterList); 1178if (token.IsKind(SyntaxKind.DelegateKeyword) && 1179token.Parent.IsKind(SyntaxKind.DelegateDeclaration)) 1193if (token.IsKind(SyntaxKind.OperatorKeyword) && 1194token.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword) 1210if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 1211token.Parent is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList)) 1225typeDecl.IsKind(SyntaxKind.ClassDeclaration) && 1226method.Modifiers.Any(SyntaxKind.StaticKeyword) && 1227typeDecl.Modifiers.Any(SyntaxKind.StaticKeyword); 1236if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1238if (token.Parent.IsKind(SyntaxKind.ParameterList) && 1239token.Parent.IsParentKind(SyntaxKind.ParenthesizedLambdaExpression)) 1255if (token.Parent is (kind: SyntaxKind.ParenthesizedExpression or SyntaxKind.TupleExpression or SyntaxKind.CastExpression)) 1269if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1273else if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter)) 1277else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName } && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 1286return parent.IsKind(SyntaxKind.ParameterList) && parent.IsParentKind(SyntaxKind.AnonymousMethodExpression); 1295if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 1328if (leftToken.IsKind(SyntaxKind.CloseParenToken)) 1331SyntaxKind.ParenthesizedExpression or 1332SyntaxKind.TupleExpression or 1333SyntaxKind.TupleType)) 1345if (leftToken.IsKind(SyntaxKind.IdentifierToken)) 1356if (leftToken.IsKind(SyntaxKind.IdentifierToken) && 1357leftToken.Parent.IsKind(SyntaxKind.IdentifierName) && 1358leftToken.Parent.Parent is (kind: SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression)) 1374if (leftToken.IsKind(SyntaxKind.OpenParenToken)) 1384if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedPattern)) 1392if (leftToken.Kind() is SyntaxKind.CaseKeyword or SyntaxKind.IsKeyword) 1399if (leftToken.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 1406if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 1413if (leftToken.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.ListPattern)) 1420if (leftToken.IsKind(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern)) 1428if (leftToken.IsKind(SyntaxKind.ColonToken) && leftToken.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) && 1429leftToken.Parent.IsParentKind(SyntaxKind.Subpattern)) 1439if (leftToken.IsKindOrHasMatchingText(SyntaxKind.AndKeyword) || leftToken.IsKindOrHasMatchingText(SyntaxKind.OrKeyword)) 1446if (leftToken.IsKind(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern)) 1455if (leftToken.Kind() is SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken or SyntaxKind.LessThanToken or SyntaxKind.LessThanEqualsToken && 1456leftToken.Parent.IsKind(SyntaxKind.RelationalPattern)) 1472if (leftToken.IsKind(SyntaxKind.DotToken) || 1473leftToken.IsKind(SyntaxKind.MinusGreaterThanToken)) 1492return leftToken.Kind() is not (SyntaxKind.OrKeyword 1493or SyntaxKind.AndKeyword 1494or SyntaxKind.NotKeyword 1495or SyntaxKind.OpenParenToken 1496or SyntaxKind.ColonColonToken 1497or SyntaxKind.DotDotToken 1498or SyntaxKind.OpenBraceToken); 1534binaryExpressionSyntax.OperatorToken.IsKind(SyntaxKind.IsKeyword) && 1576if (possibleCommaOrParen.Kind() is not (SyntaxKind.OpenParenToken or SyntaxKind.CommaToken)) 1582SyntaxKind.ParenthesizedExpression or 1583SyntaxKind.TupleExpression or 1584SyntaxKind.TupleType or 1585SyntaxKind.CastExpression)) 1591if (possibleCommaOrParen.Parent.IsKind(SyntaxKind.ParameterList) && 1616if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation) || 1617leftToken.Parent.IsParentKind(SyntaxKind.ParenthesizedVariableDesignation)) 1637if (leftToken.IsKind(SyntaxKind.OpenParenToken) && leftToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1647if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.TupleExpression)) 1657if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1681if (node.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1687if (node.Parent.IsKind(SyntaxKind.Argument) && node.Parent.Parent.IsKind(SyntaxKind.TupleExpression)) 1699if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 1700leftToken.Parent.IsKind(SyntaxKind.ArgumentList) && 1793if (token.IsKind(SyntaxKind.ConstKeyword) && 1794token.Parent.IsKind(SyntaxKind.LocalDeclarationStatement)) 1803if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.ReadOnlyKeyword) 1806if (parent is (kind: SyntaxKind.RefType or SyntaxKind.RefExpression or SyntaxKind.LocalDeclarationStatement)) 1808if (parent.IsParentKind(SyntaxKind.VariableDeclaration) && 1810SyntaxKind.LocalDeclarationStatement or 1811SyntaxKind.ForStatement or 1812SyntaxKind.ForEachVariableStatement)) 1817if (parent.Parent is (kind: SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement)) 1825if (token.IsKind(SyntaxKind.OutKeyword) && 1837if (token.IsKind(SyntaxKind.OpenParenToken)) 1840if (previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword or SyntaxKind.UsingKeyword) 1846if (token.IsKind(SyntaxKind.UsingKeyword) && 1854if (token.IsKindOrHasMatchingText(SyntaxKind.FromKeyword) && 1861if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.JoinKeyword) && 1873if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax) 1879if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent is IncompleteMemberSyntax or ScopedTypeSyntax) 1896if (token.IsKind(SyntaxKind.OpenParenToken) && 1897token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.FixedKeyword)) 1913if (token.IsKind(SyntaxKind.OpenParenToken) && 1914token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CatchKeyword)) 1927if (token.Kind() is SyntaxKind.IsKeyword or SyntaxKind.AsKeyword) 1938if (token.IsKind(SyntaxKind.NewKeyword)) 1992if (token.IsKind(SyntaxKind.None)) 2042if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.OpenParenToken) && 2056if (token.IsKind(SyntaxKind.OpenParenToken) && 2057token.Parent.IsKind(SyntaxKind.CastExpression)) 2076if (token.IsKind(SyntaxKind.CaseKeyword) && 2077token.Parent.IsKind(SyntaxKind.GotoCaseStatement)) 2082if (token.IsKind(SyntaxKind.EqualsToken) && 2085if (equalsValue.IsParentKind(SyntaxKind.VariableDeclarator) && 2086equalsValue.Parent.IsParentKind(SyntaxKind.VariableDeclaration)) 2092return fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2099return localDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2104if (equalsValue.IsParentKind(SyntaxKind.EnumMemberDeclaration)) 2110if (equalsValue.IsParentKind(SyntaxKind.Parameter)) 2118if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList) && 2119token.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken) 2125if (token.IsKind(SyntaxKind.ColonToken) && 2126token.Parent.IsKind(SyntaxKind.NameColon) && 2127token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2133if (token.IsKind(SyntaxKind.EqualsToken) && 2134token.Parent.IsKind(SyntaxKind.NameEquals) && 2135token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2205is SyntaxKind.DotToken 2206or SyntaxKind.ColonColonToken 2207or SyntaxKind.MinusGreaterThanToken) 2214if (token.IsKind(SyntaxKind.EqualsToken)) 2216if (token.Parent.IsKind(SyntaxKind.NameEquals) && 2217token.Parent.IsParentKind(SyntaxKind.UsingDirective)) 2237is SyntaxKind.EqualsToken 2238or SyntaxKind.MinusEqualsToken 2239or SyntaxKind.AsteriskEqualsToken 2240or SyntaxKind.PlusEqualsToken 2241or SyntaxKind.SlashEqualsToken 2242or SyntaxKind.ExclamationEqualsToken 2243or SyntaxKind.CaretEqualsToken 2244or SyntaxKind.AmpersandEqualsToken 2245or SyntaxKind.BarEqualsToken 2246or SyntaxKind.PercentEqualsToken 2247or SyntaxKind.LessThanLessThanEqualsToken 2248or SyntaxKind.GreaterThanGreaterThanEqualsToken 2249or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken 2250or SyntaxKind.QuestionQuestionEqualsToken) 2256if (token.IsKind(SyntaxKind.OpenParenToken)) 2258if (token.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 2331if (token.IsKind(SyntaxKind.AsteriskToken) && semanticModel != null) 2348tokenOnLeftOfPosition.IsKind(SyntaxKind.IdentifierToken)) 2351if (previousToken.Kind() is SyntaxKind.AsteriskToken or SyntaxKind.QuestionToken && 2352previousToken.Parent?.Kind() is SyntaxKind.PointerType or SyntaxKind.NullableType) 2355if (type.IsParentKind(SyntaxKind.VariableDeclaration) && 2374if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2375token.Parent.IsKind(SyntaxKind.ArrayRankSpecifier)) 2382if (token.IsKind(SyntaxKind.DotDotToken) && 2383token.Parent.IsKind(SyntaxKind.RangeExpression) && 2390if (token.IsKind(SyntaxKind.QuestionToken) && 2399if (token.IsKind(SyntaxKind.ColonToken) && 2400token.Parent.IsKind(SyntaxKind.ConditionalExpression)) 2408if (token.IsKind(SyntaxKind.OpenParenToken)) 2410if (token.Parent is (kind: SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression)) 2419if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 2430if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2431token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.BracketedArgumentList or SyntaxKind.TupleExpression)) 2440if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 2442if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList)) 2453if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 2455if (token.Parent.IsKind(SyntaxKind.Argument)) 2459else if (token.Parent.IsKind(SyntaxKind.RefExpression)) 2463if (token.Parent.IsParentKind(SyntaxKind.ParenthesizedExpression)) 2473if (token.IsKind(SyntaxKind.ColonToken) && 2474token.Parent.IsKind(SyntaxKind.NameColon) && 2475token.Parent.IsParentKind(SyntaxKind.Argument)) 2481if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 2488if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2494if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2497if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().IsKind(SyntaxKind.EqualsToken)) 2524if (token.IsKind(SyntaxKind.SemicolonToken) && 2535if (token.IsKind(SyntaxKind.OpenParenToken) && 2544if (token.IsKind(SyntaxKind.CommaToken) && 2545token.Parent.IsKind(SyntaxKind.ForStatement)) 2554if (token.IsKind(SyntaxKind.InKeyword)) 2557SyntaxKind.ForEachStatement or 2558SyntaxKind.ForEachVariableStatement or 2559SyntaxKind.FromClause or 2560SyntaxKind.JoinClause)) 2568if (token.Kind() is SyntaxKind.OnKeyword or SyntaxKind.EqualsKeyword && 2569token.Parent.IsKind(SyntaxKind.JoinClause)) 2575if (token.IsKind(SyntaxKind.WhereKeyword) && 2576token.Parent.IsKind(SyntaxKind.WhereClause)) 2583if (token.Kind() is SyntaxKind.OrderByKeyword or SyntaxKind.CommaToken && 2584token.Parent.IsKind(SyntaxKind.OrderByClause)) 2590if (token.IsKind(SyntaxKind.SelectKeyword) && 2591token.Parent.IsKind(SyntaxKind.SelectClause)) 2598if (token.Kind() is SyntaxKind.GroupKeyword or SyntaxKind.ByKeyword && 2599token.Parent.IsKind(SyntaxKind.GroupClause)) 2607if (token.IsKind(SyntaxKind.ReturnKeyword)) 2609if (token.GetPreviousToken(includeSkipped: true).Kind() != SyntaxKind.OpenBracketToken) 2616if (token.IsKind(SyntaxKind.ThrowKeyword)) 2622if (token.IsKind(SyntaxKind.OpenParenToken) && 2623token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword)) 2632if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2638if (token.IsKind(SyntaxKind.OpenParenToken) && 2639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.LockKeyword)) 2645if (token.IsKind(SyntaxKind.OpenParenToken) && 2646token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IfKeyword)) 2652if (token.IsKind(SyntaxKind.OpenParenToken) && 2653token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword)) 2659if (token.IsKind(SyntaxKind.OpenParenToken) && 2660token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword)) 2666if (token.IsKind(SyntaxKind.OpenParenToken) && 2667token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword)) 2673if (token.IsKind(SyntaxKind.OpenParenToken) && 2674token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword)) 2680if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2697if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 2698token.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 2706if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2707token.Parent.IsKind(SyntaxKind.ListPattern)) 2715if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.DotDotToken or SyntaxKind.CommaToken && 2716token.Parent.IsKind(SyntaxKind.CollectionExpression)) 2724if (token.Kind() is SyntaxKind.DotDotToken && 2725token.Parent.IsKind(SyntaxKind.SpreadElement)) 2736if (token.IsKind(SyntaxKind.OpenBraceToken)) 2757if (token.IsKind(SyntaxKind.DotToken)) 2760if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2763while (parentMemberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2768if (parentMemberAccess.Parent.IsKind(SyntaxKind.Argument) && 2776if (token.Parent.IsKind(SyntaxKind.QualifiedName)) 2779while (parentQualifiedName.Parent.IsKind(SyntaxKind.QualifiedName)) 2784if (parentQualifiedName.Parent.IsKind(SyntaxKind.Argument) && 2795if (token.Parent.IsKind(SyntaxKind.ArgumentList) && 2829if (token.IsKind(SyntaxKind.NumericLiteralToken)) 2859if (type.Kind() is SyntaxKind.GenericName or SyntaxKind.AliasQualifiedName or SyntaxKind.PredefinedType) 2874if (token.IsKind(SyntaxKind.IdentifierToken) && 2875token.Parent.IsKind(SyntaxKind.IdentifierName) && 2876token.Parent.Parent is (kind: SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression)) 2882if (token.Kind() is SyntaxKind.IdentifierToken && 2883token.Parent.IsKind(SyntaxKind.IdentifierName)) 2885if (token.Parent.Parent is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword }) 2889if (token.Text == SyntaxFacts.GetText(SyntaxKind.AsyncKeyword)) 2907if (tokenBeforeName.Kind() == SyntaxKind.CaseKeyword) 2925case SyntaxKind.QualifiedName: 2927case SyntaxKind.AliasQualifiedName: 2929case SyntaxKind.SimpleMemberAccessExpression: 2958if (token.IsKind(SyntaxKind.CloseBraceToken)) 2964block.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.CatchClause) 2984if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CatchKeyword)) 2989if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CloseParenToken) && 2990token.Parent.IsKind(SyntaxKind.CatchDeclaration)) 3007targetToken is (kind: SyntaxKind.ColonToken or SyntaxKind.CommaToken) && 3018targetToken.IsKind(SyntaxKind.ColonToken) && 3019targetToken.Parent.IsKind(SyntaxKind.BaseList) && 3020targetToken.Parent.IsParentKind(SyntaxKind.EnumDeclaration); 3029if (!token.IsKind(SyntaxKind.DotToken)) 3035if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 3041token.Parent?.Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) binaryExpression && 3080return targetToken.IsKind(SyntaxKind.AsteriskToken) && 3081targetToken.GetPreviousToken().IsKind(SyntaxKind.DelegateKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (6)
30if (expression.IsKind(SyntaxKind.RefExpression)) 42if (expression.IsKind(SyntaxKind.ThrowExpression)) 58Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 60Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty)); 72Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 74Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (2)
43constraints.Add(ClassOrStructConstraint(SyntaxKind.ClassConstraint)); 51constraints.Add(ClassOrStructConstraint(SyntaxKind.StructConstraint));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
97if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.UnsafeKeyword)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
111SyntaxKind.SimpleMemberAccessExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\NameSyntaxExtensions.cs (4)
36is SyntaxKind.AliasQualifiedName 37or SyntaxKind.NameColon 38or SyntaxKind.NameEquals 39or SyntaxKind.TypeParameterConstraintClause)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SeparatedSyntaxListExtensions.cs (4)
12this SeparatedSyntaxList<T> separatedList, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken) 19this SeparatedSyntaxList<T> separatedList, int index, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (2)
23var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 47default, SyntaxKind.None, "@" + unescaped, unescaped, default);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTokenListExtensions.cs (1)
12public static IEnumerable<SyntaxToken> SkipKinds(this SyntaxTokenList tokenList, params SyntaxKind[] kinds)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTreeExtensions.cs (17)
58if (token.Kind() == SyntaxKind.None) 74case SyntaxKind.LessThanToken: 81if (token.Kind() == SyntaxKind.None) 92if (token.Kind() == SyntaxKind.IdentifierToken) 113case SyntaxKind.GreaterThanToken: 114case SyntaxKind.GreaterThanGreaterThanToken: 115case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 127case SyntaxKind.AsteriskToken: // for int* 128case SyntaxKind.QuestionToken: // for int? 129case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 130case SyntaxKind.ColonColonToken: // for global:: 131case SyntaxKind.CloseBracketToken: 132case SyntaxKind.OpenBracketToken: 133case SyntaxKind.DotToken: 134case SyntaxKind.IdentifierToken: 137case SyntaxKind.CommaToken: 162if (token.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (6)
74if (typeNode.Modifiers.Any(SyntaxKind.PartialKeyword)) 97private static SyntaxToken EnsureToken(SyntaxToken token, SyntaxKind kind, bool prependNewLineIfMissing = false, bool appendNewLineIfMissing = false) 99if (token.IsMissing || token.IsKind(SyntaxKind.None)) 111var openBrace = EnsureToken(typeDeclaration.OpenBraceToken, SyntaxKind.OpenBraceToken); 112var closeBrace = EnsureToken(typeDeclaration.CloseBraceToken, SyntaxKind.CloseBraceToken, appendNewLineIfMissing: true); 117if (addedBraces && typeDeclaration.SemicolonToken.IsKind(SyntaxKind.SemicolonToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (26)
50token.Kind() is SyntaxKind.EndOfFileToken or SyntaxKind.None || 58if (token.IsKind(SyntaxKind.CloseParenToken) && !token.Parent.IsKind(SyntaxKind.UsingStatement)) 63if (token.IsKind(SyntaxKind.ColonToken) && !token.Parent.IsKind(SyntaxKind.LabeledStatement) && token.Parent is not SwitchLabelSyntax) 67if (token.IsKind(SyntaxKind.OpenBraceToken) && !token.IsFirstTokenOnLine(documentSyntax.Text)) 129(token.IsKind(SyntaxKind.CloseBraceToken) && OnlySmartIndentCloseBrace(indentationOptions.AutoFormattingOptions)) || 130(token.IsKind(SyntaxKind.OpenBraceToken) && OnlySmartIndentOpenBrace(indentationOptions.AutoFormattingOptions)); 151if (token.Kind() != SyntaxKind.ElseKeyword || 199if (endToken.IsKind(SyntaxKind.OpenBraceToken)) 289if (tokenBeforeCaret.Kind() is SyntaxKind.CloseBraceToken or 290SyntaxKind.EndOfFileToken) 301internal static bool ValidSingleOrMultiCharactersTokenKind(char typedChar, SyntaxKind kind) 304'n' => kind is SyntaxKind.RegionKeyword or SyntaxKind.EndRegionKeyword, 305't' => kind is SyntaxKind.SelectKeyword, 306'e' => kind is SyntaxKind.WhereKeyword or SyntaxKind.ElseKeyword, 317is SyntaxKind.None 318or SyntaxKind.EndOfDirectiveToken 319or SyntaxKind.EndOfFileToken; 354if (currentToken.Kind() == SyntaxKind.OpenBraceToken && 356currentTokenParentParent.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression or SyntaxKind.AnonymousMethodExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\TypingFormattingRule.cs (1)
104while (node != null && node.Kind() != SyntaxKind.CompilationUnit)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (8)
79if (token.IsKind(SyntaxKind.None) || 89if (previousToken.Kind() == SyntaxKind.None || previousToken.IsMissing) 109return token.Kind() is SyntaxKind.None or SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken; 125node.IsKind(SyntaxKind.Interpolation)) 132!argument.Parent.IsKind(SyntaxKind.ThisConstructorInitializer) && 141constructorInitializer.ArgumentList.OpenParenToken.Kind() != SyntaxKind.None &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (22)
74Contract.ThrowIfTrue(token.Kind() == SyntaxKind.None); 81if (token.IsKind(SyntaxKind.MultiLineRawStringLiteralToken)) 120if (token.Kind() is SyntaxKind.InterpolatedMultiLineRawStringStartToken or SyntaxKind.InterpolatedStringTextToken 121|| token is { RawKind: (int)SyntaxKind.CloseBraceToken, Parent: InterpolationSyntax }) 125if (interpolatedExpression.StringStartToken.IsKind(SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 139if (!indenter.Root.FindToken(currentLine.Start, findInsideTrivia: true).IsKind(SyntaxKind.InterpolatedStringTextToken)) 175token.Kind() is SyntaxKind.InterpolatedVerbatimStringStartToken or SyntaxKind.InterpolatedStringTextToken || 176(token.IsKind(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation))) 240case SyntaxKind.SemicolonToken: 251case SyntaxKind.CloseBraceToken: 253if (token.Parent.IsKind(SyntaxKind.AccessorList) && 254token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration)) 265case SyntaxKind.OpenBraceToken: 270case SyntaxKind.ColonToken: 283case SyntaxKind.CloseBracketToken: 297case SyntaxKind.XmlTextLiteralToken: 302case SyntaxKind.CommaToken: 307case SyntaxKind.CloseParenToken: 309if (token.Parent.IsKind(SyntaxKind.ArgumentList))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpAddImportsService.cs (1)
103=> SyntaxFactory.AreEquivalent(a, b, kind => kind == SyntaxKind.NullableDirectiveTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
63(i == 0 && currentUsing.IsParentKind(SyntaxKind.FileScopedNamespaceDeclaration)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
78contextualKind: SyntaxKind.UnderscoreToken, 104kind: SyntaxKind.IsExpression, 251kind: SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (2)
85if (braces.openBrace.Kind() == SyntaxKind.None && 86braces.closeBrace.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (19)
67.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 109=> SyntaxFactory.YieldStatement(SyntaxKind.YieldReturnStatement, (ExpressionSyntax)expression); 126SyntaxKind.InterpolatedStringTextToken, 139SyntaxFactory.Token(default, SyntaxKind.InterpolatedStringTextToken, format, format, default)); 216=> SyntaxFactory.BinaryPattern(SyntaxKind.AndPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 242=> SyntaxFactory.BinaryPattern(SyntaxKind.OrPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 270return SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression); 276return SyntaxFactory.LiteralExpression(SyntaxKind.FalseLiteralExpression); 289SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal("0", 0)); 313SyntaxKind.SimpleMemberAccessExpression, 325is SyntaxKind.ThisExpression 326or SyntaxKind.BaseExpression 327or SyntaxKind.ParenthesizedExpression 328or SyntaxKind.SimpleMemberAccessExpression 329or SyntaxKind.InvocationExpression 330or SyntaxKind.ElementAccessExpression 331or SyntaxKind.MemberBindingExpression) 340=> CreateBinaryExpression(SyntaxKind.BitwiseOrExpression, left, right); 342public static SyntaxNode CreateBinaryExpression(SyntaxKind syntaxKind, SyntaxNode left, SyntaxNode right)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (81)
327if (argument.Parent.IsParentKind(SyntaxKind.ImplicitElementAccess) && 328argument.Parent.Parent.IsParentKind(SyntaxKind.SimpleAssignmentExpression) && 329argument.Parent.Parent.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression) && 350if (previousToken.IsKind(SyntaxKind.CommaToken)) 431if (previousToken.Kind() == SyntaxKind.NewKeyword && 432previousToken.GetPreviousToken().Kind() is SyntaxKind.EqualsToken or SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 518if (previousToken != argumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 548if (previousToken != attributeArgumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 822if (previousToken.HasValue && previousToken.Value.GetPreviousToken().Kind() == SyntaxKind.EqualsToken) 897if (previousToken != bracketedArgumentList.OpenBracketToken && previousToken.Kind() != SyntaxKind.CommaToken) 954if (binop.Kind() == SyntaxKind.CoalesceExpression) 962case SyntaxKind.LessThanLessThanToken: 963case SyntaxKind.GreaterThanGreaterThanToken: 964case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 965case SyntaxKind.LessThanLessThanEqualsToken: 966case SyntaxKind.GreaterThanGreaterThanEqualsToken: 967case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 979if (operatorToken.Kind() is SyntaxKind.AmpersandAmpersandToken or 980SyntaxKind.BarBarToken) 986if (binop.Kind() == SyntaxKind.SimpleAssignmentExpression && 1015if (operatorToken.Kind() is SyntaxKind.AmpersandToken or 1016SyntaxKind.AmpersandEqualsToken or 1017SyntaxKind.BarToken or 1018SyntaxKind.BarEqualsToken or 1019SyntaxKind.CaretToken or 1020SyntaxKind.CaretEqualsToken) 1031if (operatorToken.Kind() == SyntaxKind.PlusToken) 1046case SyntaxKind.BarToken: 1047case SyntaxKind.CaretToken: 1048case SyntaxKind.AmpersandToken: 1049case SyntaxKind.LessThanToken: 1050case SyntaxKind.LessThanEqualsToken: 1051case SyntaxKind.GreaterThanToken: 1052case SyntaxKind.GreaterThanEqualsToken: 1053case SyntaxKind.PlusToken: 1054case SyntaxKind.MinusToken: 1055case SyntaxKind.AsteriskToken: 1056case SyntaxKind.SlashToken: 1057case SyntaxKind.PercentToken: 1058case SyntaxKind.CaretEqualsToken: 1059case SyntaxKind.PlusEqualsToken: 1060case SyntaxKind.MinusEqualsToken: 1061case SyntaxKind.AsteriskEqualsToken: 1062case SyntaxKind.SlashEqualsToken: 1063case SyntaxKind.PercentEqualsToken: 1064case SyntaxKind.LessThanLessThanToken: 1065case SyntaxKind.GreaterThanGreaterThanToken: 1066case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 1067case SyntaxKind.LessThanLessThanEqualsToken: 1068case SyntaxKind.GreaterThanGreaterThanEqualsToken: 1069case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 1072case SyntaxKind.BarEqualsToken: 1073case SyntaxKind.AmpersandEqualsToken: 1224if (equalsValue.IsParentKind(SyntaxKind.Parameter) && 1381if (initializerExpression.IsKind(SyntaxKind.ComplexElementInitializerExpression)) 1401else if (initializerExpression.IsKind(SyntaxKind.CollectionInitializerExpression)) 1423foreach (var sibling in initializerExpression.Expressions.Where(e => e.Kind() != SyntaxKind.ComplexElementInitializerExpression)) 1492else if (initializerExpression.IsParentKind(SyntaxKind.SimpleAssignmentExpression)) 1582if (identifier.HasMatchingText(SyntaxKind.OrKeyword) || 1583identifier.HasMatchingText(SyntaxKind.AndKeyword)) 1703var isAsync = anonymousFunction.AsyncKeyword.Kind() != SyntaxKind.None; 1807memberAccessExpression.Parent.IsParentKind(SyntaxKind.AwaitExpression)) 1831if (ienumerableType != null && memberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression, out invocation)) 1973case SyntaxKind.PostDecrementExpression: 1974case SyntaxKind.PostIncrementExpression: 1988case SyntaxKind.PreDecrementExpression: 1989case SyntaxKind.PreIncrementExpression: 1990case SyntaxKind.UnaryPlusExpression: 1991case SyntaxKind.UnaryMinusExpression: 1995case SyntaxKind.BitwiseNotExpression: 2007case SyntaxKind.LogicalNotExpression: 2011case SyntaxKind.AddressOfExpression: 2062if (previousToken.HasValue && (previousToken.Value != yieldStatement.ReturnOrBreakKeyword || yieldStatement.ReturnOrBreakKeyword.IsKind(SyntaxKind.BreakKeyword))) 2180if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2192switchLabel.Kind() != SyntaxKind.CaseSwitchLabel) 2211.FirstOrDefault(label => label.Kind() == SyntaxKind.CaseSwitchLabel) is CaseSwitchLabelSyntax firstCase) 2270if (variableDeclaration.IsParentKind(SyntaxKind.UsingStatement)) 2274if (variableDeclaration.IsParentKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
276.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (5)
23if (SyntaxFacts.GetKeywordKind(syntaxToken.ValueText) == SyntaxKind.None && SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.None) 28if (SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.UnderscoreToken) 34if (parentOfToken is SimpleNameSyntax && parent.Kind() == SyntaxKind.XmlNameAttribute) 41if (parent.Kind() == SyntaxKind.AliasQualifiedName &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NameSyntaxIterator.cs (1)
27if (currentNode.Kind() == SyntaxKind.QualifiedName)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\SyntaxKindSet.cs (101)
11public static readonly ISet<SyntaxKind> AllTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 13SyntaxKind.AbstractKeyword, 15SyntaxKind.ClosedKeyword, 17SyntaxKind.FileKeyword, 18SyntaxKind.InternalKeyword, 19SyntaxKind.NewKeyword, 20SyntaxKind.PublicKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.ProtectedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.ReadOnlyKeyword, 27SyntaxKind.RefKeyword 30public static readonly ISet<SyntaxKind> AllMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 32SyntaxKind.AbstractKeyword, 33SyntaxKind.AsyncKeyword, 34SyntaxKind.ExternKeyword, 35SyntaxKind.InternalKeyword, 36SyntaxKind.NewKeyword, 37SyntaxKind.OverrideKeyword, 38SyntaxKind.PublicKeyword, 39SyntaxKind.PrivateKeyword, 40SyntaxKind.ProtectedKeyword, 41SyntaxKind.ReadOnlyKeyword, 42SyntaxKind.RequiredKeyword, 43SyntaxKind.SealedKeyword, 44SyntaxKind.StaticKeyword, 45SyntaxKind.UnsafeKeyword, 46SyntaxKind.VirtualKeyword, 47SyntaxKind.VolatileKeyword, 50public static readonly ISet<SyntaxKind> AllGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 52SyntaxKind.ExternKeyword, 53SyntaxKind.InternalKeyword, 54SyntaxKind.NewKeyword, 55SyntaxKind.OverrideKeyword, 56SyntaxKind.PublicKeyword, 57SyntaxKind.PrivateKeyword, 58SyntaxKind.ReadOnlyKeyword, 59SyntaxKind.StaticKeyword, 60SyntaxKind.UnsafeKeyword, 61SyntaxKind.VolatileKeyword, 64public static readonly ISet<SyntaxKind> AccessibilityModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 66SyntaxKind.PublicKeyword, 67SyntaxKind.PrivateKeyword, 68SyntaxKind.ProtectedKeyword, 69SyntaxKind.InternalKeyword, 72public static readonly ISet<SyntaxKind> AllTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 74SyntaxKind.InterfaceDeclaration, 75SyntaxKind.ClassDeclaration, 76SyntaxKind.RecordDeclaration, 77SyntaxKind.StructDeclaration, 78SyntaxKind.RecordStructDeclaration, 80SyntaxKind.UnionDeclaration, 82SyntaxKind.EnumDeclaration, 85public static readonly ISet<SyntaxKind> ClassInterfaceStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 87SyntaxKind.InterfaceDeclaration, 88SyntaxKind.ClassDeclaration, 89SyntaxKind.RecordDeclaration, 90SyntaxKind.StructDeclaration, 91SyntaxKind.RecordStructDeclaration, 93SyntaxKind.UnionDeclaration, 97public static readonly ISet<SyntaxKind> NonEnumTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 99SyntaxKind.ClassDeclaration, 101SyntaxKind.ExtensionBlockDeclaration, 102SyntaxKind.UnionDeclaration, 104SyntaxKind.InterfaceDeclaration, 105SyntaxKind.RecordDeclaration, 106SyntaxKind.RecordStructDeclaration, 107SyntaxKind.StructDeclaration, 110public static readonly ISet<SyntaxKind> ClassInterfaceRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 112SyntaxKind.InterfaceDeclaration, 113SyntaxKind.ClassDeclaration, 114SyntaxKind.RecordDeclaration, 117public static readonly ISet<SyntaxKind> ClassRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 119SyntaxKind.ClassDeclaration, 120SyntaxKind.RecordDeclaration, 123public static readonly ISet<SyntaxKind> ClassStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 125SyntaxKind.ClassDeclaration, 126SyntaxKind.RecordDeclaration, 127SyntaxKind.StructDeclaration, 128SyntaxKind.RecordStructDeclaration, 130SyntaxKind.UnionDeclaration, 134public static readonly ISet<SyntaxKind> StructOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 136SyntaxKind.StructDeclaration, 137SyntaxKind.RecordStructDeclaration, 139SyntaxKind.UnionDeclaration, 143public static readonly ISet<SyntaxKind> InterfaceOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 145SyntaxKind.InterfaceDeclaration,
Microsoft.CodeAnalysis.CSharp.Features (4100)
AddImport\CSharpAddImportFeatureService.cs (10)
55if (node.Parent is not MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) simpleMemberAccess || 75else if (node.Parent.IsKind(SyntaxKind.CollectionInitializerExpression)) 126if (nameNode?.Parent?.Kind() is not SyntaxKind.SimpleMemberAccessExpression and not SyntaxKind.MemberBindingExpression) 131if (memberAccess?.Parent?.Kind() is SyntaxKind.SimpleMemberAccessExpression or SyntaxKind.ElementAccessExpression || 132memberBinding?.Parent?.Kind() is SyntaxKind.SimpleMemberAccessExpression or SyntaxKind.ElementAccessExpression) 422if (SyntaxFacts.GetKeywordKind(part) != SyntaxKind.None) 623if (node.Parent.IsKind(SyntaxKind.CollectionInitializerExpression))
BraceCompletion\BracketBraceCompletionService.cs (4)
31protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.OpenBracketToken); 33protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CloseBracketToken); 49if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && currentToken.Parent.IsKind(SyntaxKind.ListPattern))
BraceCompletion\CharLiteralBraceCompletionService.cs (2)
25protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CharacterLiteralToken); 27protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CharacterLiteralToken);
BraceCompletion\CurlyBraceCompletionService.cs (32)
48=> token.IsKind(SyntaxKind.OpenBraceToken) && !token.Parent.IsKind(SyntaxKind.Interpolation); 51=> token.IsKind(SyntaxKind.CloseBraceToken); 126if (!currentToken.IsKind(SyntaxKind.OpenBraceToken)) 140SyntaxKind.ObjectInitializerExpression or 141SyntaxKind.CollectionInitializerExpression or 142SyntaxKind.ArrayInitializerExpression or 143SyntaxKind.ImplicitArrayCreationExpression or 144SyntaxKind.WithInitializerExpression or 145SyntaxKind.PropertyPatternClause)) 159if (currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 165if (currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 177if (currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 201if (node.IsKind(SyntaxKind.SwitchStatement)) 210case SyntaxKind.IfStatement: 211case SyntaxKind.ElseClause: 212case SyntaxKind.WhileStatement: 213case SyntaxKind.DoStatement: 214case SyntaxKind.ForEachStatement: 215case SyntaxKind.ForEachVariableStatement: 216case SyntaxKind.UsingStatement: 217case SyntaxKind.ForStatement: 218case SyntaxKind.TryStatement: 219case SyntaxKind.CatchClause: 220case SyntaxKind.FinallyClause: 221case SyntaxKind.LockStatement: 222case SyntaxKind.CheckedStatement: 223case SyntaxKind.UncheckedStatement: 224case SyntaxKind.SwitchSection: 225case SyntaxKind.FixedStatement: 226case SyntaxKind.UnsafeStatement:
BraceCompletion\InterpolatedStringBraceCompletionService.cs (3)
37=> leftToken.Kind() is SyntaxKind.InterpolatedStringStartToken or SyntaxKind.InterpolatedVerbatimStringStartToken; 40=> rightToken.IsKind(SyntaxKind.InterpolatedStringEndToken);
BraceCompletion\InterpolationBraceCompletionService.cs (5)
42=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation); 45=> token.IsKind(SyntaxKind.CloseBraceToken); 67return token.Parent.IsKind(SyntaxKind.InterpolatedStringExpression) || token.Parent.IsParentKind(SyntaxKind.InterpolatedStringExpression);
BraceCompletion\LessAndGreaterThanBraceCompletionService.cs (3)
33=> token.IsKind(SyntaxKind.LessThanToken); 36=> token.IsKind(SyntaxKind.GreaterThanToken); 52if (token.Parent is not BinaryExpressionSyntax(SyntaxKind.LessThanExpression) node || node.OperatorToken != token)
BraceCompletion\ParenthesisBraceCompletionService.cs (3)
26protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.OpenParenToken); 28protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.CloseParenToken); 44if (closeParen.Kind() != SyntaxKind.CloseParenToken || closeParen.Span.Length == 0)
BraceCompletion\StringLiteralBraceCompletionService.cs (4)
51protected override bool IsValidOpeningBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.StringLiteralToken); 53protected override bool IsValidClosingBraceToken(SyntaxToken token) => token.IsKind(SyntaxKind.StringLiteralToken); 73if (token.IsKind(SyntaxKind.StringLiteralToken) && 96while (!token.IsKind(SyntaxKind.None) && !token.TrailingTrivia.Contains(t => t.IsEndOfLine()))
BraceMatching\AbstractCSharpBraceMatcher.cs (2)
11protected AbstractCSharpBraceMatcher(SyntaxKind openBrace, SyntaxKind closeBrace)
BraceMatching\BlockCommentBraceMatcher.cs (2)
47if (trivia.Kind() is SyntaxKind.MultiLineCommentTrivia && 52else if (trivia.Kind() is SyntaxKind.MultiLineDocumentationCommentTrivia)
BraceMatching\LessThanGreaterThanBraceMatcher.cs (2)
18: base(SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken)
BraceMatching\OpenCloseBraceBraceMatcher.cs (2)
18: base(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken)
BraceMatching\OpenCloseBracketBraceMatcher.cs (2)
18: base(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken)
BraceMatching\OpenCloseParenBraceMatcher.cs (2)
18: base(SyntaxKind.OpenParenToken, SyntaxKind.CloseParenToken)
BraceMatching\StringLiteralBraceMatcher.cs (5)
33if (token.IsKind(SyntaxKind.StringLiteralToken)) 37else if (token.IsKind(SyntaxKind.Utf8StringLiteralToken)) 41else if (token.Kind() is SyntaxKind.InterpolatedStringStartToken or SyntaxKind.InterpolatedVerbatimStringStartToken) 48else if (token.IsKind(SyntaxKind.InterpolatedStringEndToken))
ChangeSignature\ChangeSignatureFormattingRule.cs (7)
19private static readonly ImmutableArray<SyntaxKind> s_allowableKinds = 21SyntaxKind.ParameterList, 22SyntaxKind.ArgumentList, 23SyntaxKind.BracketedParameterList, 24SyntaxKind.BracketedArgumentList, 25SyntaxKind.AttributeArgumentList, 54if (previousToken.Kind() == SyntaxKind.CommaToken && s_allowableKinds.Contains(previousToken.Parent.Kind()))
ChangeSignature\CSharpChangeSignatureService.cs (83)
41private static readonly ImmutableArray<SyntaxKind> _declarationKinds = 43SyntaxKind.MethodDeclaration, 44SyntaxKind.ConstructorDeclaration, 45SyntaxKind.IndexerDeclaration, 46SyntaxKind.DelegateDeclaration, 47SyntaxKind.SimpleLambdaExpression, 48SyntaxKind.ParenthesizedLambdaExpression, 49SyntaxKind.LocalFunctionStatement, 50SyntaxKind.RecordStructDeclaration, 51SyntaxKind.RecordDeclaration, 52SyntaxKind.StructDeclaration, 53SyntaxKind.ClassDeclaration, 56private static readonly ImmutableArray<SyntaxKind> _declarationAndInvocableKinds = 58SyntaxKind.InvocationExpression, 59SyntaxKind.ElementAccessExpression, 60SyntaxKind.ThisConstructorInitializer, 61SyntaxKind.BaseConstructorInitializer, 62SyntaxKind.ObjectCreationExpression, 63SyntaxKind.ImplicitObjectCreationExpression, 64SyntaxKind.Attribute, 65SyntaxKind.NameMemberCref]; 67private static readonly ImmutableArray<SyntaxKind> _updatableAncestorKinds = 69SyntaxKind.ConstructorDeclaration, 70SyntaxKind.IndexerDeclaration, 71SyntaxKind.InvocationExpression, 72SyntaxKind.ElementAccessExpression, 73SyntaxKind.ThisConstructorInitializer, 74SyntaxKind.BaseConstructorInitializer, 75SyntaxKind.ObjectCreationExpression, 76SyntaxKind.Attribute, 77SyntaxKind.DelegateDeclaration, 78SyntaxKind.SimpleLambdaExpression, 79SyntaxKind.ParenthesizedLambdaExpression, 80SyntaxKind.NameMemberCref, 81SyntaxKind.PrimaryConstructorBaseType, 84private static readonly ImmutableArray<SyntaxKind> _updatableNodeKinds = 86SyntaxKind.MethodDeclaration, 87SyntaxKind.LocalFunctionStatement, 88SyntaxKind.ConstructorDeclaration, 89SyntaxKind.IndexerDeclaration, 90SyntaxKind.InvocationExpression, 91SyntaxKind.ElementAccessExpression, 92SyntaxKind.ThisConstructorInitializer, 93SyntaxKind.BaseConstructorInitializer, 94SyntaxKind.ObjectCreationExpression, 95SyntaxKind.ImplicitObjectCreationExpression, 96SyntaxKind.Attribute, 97SyntaxKind.DelegateDeclaration, 98SyntaxKind.NameMemberCref, 99SyntaxKind.AnonymousMethodExpression, 100SyntaxKind.ParenthesizedLambdaExpression, 101SyntaxKind.SimpleLambdaExpression, 102SyntaxKind.RecordStructDeclaration, 103SyntaxKind.RecordDeclaration, 104SyntaxKind.StructDeclaration, 105SyntaxKind.ClassDeclaration, 106SyntaxKind.PrimaryConstructorBaseType, 124if (token.Kind() == SyntaxKind.SemicolonToken && token.Parent is StatementSyntax) 200current.Kind() == SyntaxKind.Block || current.Kind() == SyntaxKind.ArrowExpressionClause) 264case SyntaxKind.InvocationExpression: 267case SyntaxKind.ElementAccessExpression: 270case SyntaxKind.ObjectCreationExpression: 273case SyntaxKind.PrimaryConstructorBaseType: 274case SyntaxKind.ConstructorDeclaration: 275case SyntaxKind.IndexerDeclaration: 276case SyntaxKind.ThisConstructorInitializer: 277case SyntaxKind.BaseConstructorInitializer: 278case SyntaxKind.Attribute: 279case SyntaxKind.DelegateDeclaration: 280case SyntaxKind.NameMemberCref: 301is SyntaxKind.MethodDeclaration 302or SyntaxKind.ConstructorDeclaration 303or SyntaxKind.IndexerDeclaration 304or SyntaxKind.DelegateDeclaration 305or SyntaxKind.RecordStructDeclaration 306or SyntaxKind.RecordDeclaration 307or SyntaxKind.StructDeclaration 308or SyntaxKind.ClassDeclaration) 695var oldOnlyHasWhitespaceTrivia = oldTrivia.All(t => t.IsKind(SyntaxKind.WhitespaceTrivia)); 698var newOnlyHasWhitespaceTrivia = newTrivia.All(t => t.IsKind(SyntaxKind.WhitespaceTrivia)); 878if (!node.IsKind(SyntaxKind.IdentifierName) || 924var initializerExpression = InitializerExpression(SyntaxKind.ArrayInitializerExpression, listOfArguments);
ChangeSignature\UnifiedArgumentSyntax.cs (2)
19Debug.Assert(argument.Kind() is SyntaxKind.Argument or SyntaxKind.AttributeArgument);
CodeFixes\GenerateType\GenerateTypeCodeFixProvider.cs (1)
44SimpleNameSyntax simple => !simple.IsParentKind(SyntaxKind.QualifiedName),
CodeFixes\Suppression\CSharpSuppressionCodeFixProvider.cs (15)
90attributeList.Target.Identifier.Kind() == SyntaxKind.AssemblyKeyword; 94=> trivia.Kind() is SyntaxKind.EndOfLineTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia; 97=> token.Kind() == SyntaxKind.EndOfFileToken; 180var category = LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(diagnostic.Descriptor.Category)); 185var ruleId = LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(ruleIdText)); 188var justificationExpr = LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(FeaturesResources.Pending)); 198var scopeExpr = LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(scopeString)); 202var targetExpr = LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(targetString)); 224if (trivia.Kind() == SyntaxKind.PragmaWarningDirectiveTrivia) 227enableDirective = pragmaWarning.DisableOrRestoreKeyword.Kind() == SyntaxKind.RestoreKeyword; 241var toggledKeywordKind = currentKeyword.Kind() == SyntaxKind.DisableKeyword ? SyntaxKind.RestoreKeyword : SyntaxKind.DisableKeyword;
CodeLens\CSharpCodeLensDisplayInfoService.cs (15)
40case SyntaxKind.LocalDeclarationStatement: 46case SyntaxKind.FieldDeclaration: 47case SyntaxKind.EventFieldDeclaration: 53case SyntaxKind.VariableDeclaration: 58case SyntaxKind.PredefinedType: 62case SyntaxKind.MultiLineDocumentationCommentTrivia: 63case SyntaxKind.SingleLineDocumentationCommentTrivia: 96if (node.Parent.IsKind(SyntaxKind.AccessorList) && 97node.Parent.Parent.IsKind(SyntaxKind.IndexerDeclaration)) 104case SyntaxKind.ConstructorDeclaration: 119case SyntaxKind.IndexerDeclaration: 132case SyntaxKind.OperatorDeclaration: 145case SyntaxKind.ConversionOperatorDeclaration: 159case SyntaxKind.UsingDirective: 166case SyntaxKind.ExternAliasDirective:
CodeRefactorings\AddAwait\CSharpAddAwaitCodeRefactoringProvider.cs (1)
39return methodDeclaration.Modifiers.Any(SyntaxKind.AsyncKeyword);
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (1)
240if (node.IsParentKind(SyntaxKind.CastExpression))
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (29)
27directive => directive.IsKind(SyntaxKind.NullableDirectiveTrivia); 48if (token.IsKind(SyntaxKind.EndOfDirectiveToken)) 51if (token.Kind() is not (SyntaxKind.EnableKeyword or SyntaxKind.RestoreKeyword or SyntaxKind.DisableKeyword or SyntaxKind.NullableKeyword or SyntaxKind.HashToken) || 100if (firstToken.IsKind(SyntaxKind.None)) 121if (firstNonDirectiveToken.IsKind(SyntaxKind.None) && firstDirective is null) 138if (originalNode.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 144if (originalNode.SettingToken.IsKind(SyntaxKind.RestoreKeyword)) 149if (originalNode.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 176else if (leadingDirective.SettingToken.IsKind(SyntaxKind.RestoreKeyword) && leadingDirective.TargetToken.IsKind(SyntaxKind.None)) 197case SyntaxKind.WhitespaceTrivia: 198case SyntaxKind.EndOfLineTrivia: 199case SyntaxKind.SingleLineCommentTrivia: 200case SyntaxKind.MultiLineCommentTrivia: 203case SyntaxKind.SingleLineDocumentationCommentTrivia: 204case SyntaxKind.MultiLineDocumentationCommentTrivia: 220if (firstToken.IsKind(SyntaxKind.None)) 225if (firstToken.IsKind(SyntaxKind.HashToken) && firstToken.Parent.IsKind(SyntaxKind.RegionDirectiveTrivia)) 230if (nextToken.IsKind(SyntaxKind.HashToken) && nextToken.Parent.IsKind(SyntaxKind.EndRegionDirectiveTrivia)) 243var firstRelevantDirective = root.GetFirstDirective(static directive => directive.Kind() is SyntaxKind.NullableDirectiveTrivia or SyntaxKind.IfDirectiveTrivia); 245&& nullableDirective.TargetToken.IsKind(SyntaxKind.None)) 248if (firstSemanticToken.IsKind(SyntaxKind.None) || firstSemanticToken.SpanStart > nullableDirective.Span.End)
CodeRefactorings\InlineMethod\CSharpInlineMethodRefactoringProvider.cs (11)
66=> node.IsKind(SyntaxKind.FieldDeclaration); 91is SyntaxKind.InvocationExpression 92or SyntaxKind.ObjectCreationExpression 93or SyntaxKind.PreIncrementExpression 94or SyntaxKind.PreDecrementExpression 95or SyntaxKind.PostIncrementExpression 96or SyntaxKind.PostDecrementExpression 97or SyntaxKind.AwaitExpression; 112BinaryExpressionSyntax(kind: SyntaxKind.CoalesceExpression) binaryExpressionSyntax 116var parent => parent.IsKind(SyntaxKind.ArrowExpressionClause), 133(whenNotNull.IsKind(SyntaxKind.InvocationExpression) || IsNullConditionalInvocationExpression(whenNotNull));
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (22)
64variableDeclarator.Initializer.Value.IsKind(SyntaxKind.StackAllocArrayCreationExpression)) 69if (variableDeclaration.Type.Kind() == SyntaxKind.RefType) 112if (argument.RefOrOutKeyword.Kind() != SyntaxKind.None) 116SyntaxKind.PreDecrementExpression or 117SyntaxKind.PreIncrementExpression or 118SyntaxKind.PostDecrementExpression or 119SyntaxKind.PostIncrementExpression or 120SyntaxKind.AddressOfExpression) 264var leadingTrivia = spreadElement.GetLeadingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia) space] 307if (descendantNodesAndSelf.Any(n => n.Kind() is SyntaxKind.ObjectCreationExpression or SyntaxKind.InvocationExpression)) 341while (scope.IsKind(SyntaxKind.LabeledStatement)) 347if (scope.IsKind(SyntaxKind.GlobalStatement)) 394.SkipWhile(t => t.IsKind(SyntaxKind.WhitespaceTrivia)) 400.SkipWhile(t => t is (kind: SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia)) 462else if (expression is InitializerExpressionSyntax(SyntaxKind.ArrayInitializerExpression) arrayInitializer) 506while (parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression) 509while (parent.IsKind(SyntaxKind.Argument)) 512if (!parent.IsKind(SyntaxKind.TupleExpression)) 516else if (parent?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment)
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (2)
168newNode = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, memberAccessNamespaceName, nameRef.WithoutTrivia()); 448SyntaxKind.SimpleMemberAccessExpression,
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (3)
41Debug.Assert(declaration.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression);
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (6)
30using static SyntaxKind; 318if (designation is not { Parent: PatternSyntax(not SyntaxKind.ListPattern) containingPattern }) 324Debug.Assert(containingPattern.Kind() is SyntaxKind.VarPattern or SyntaxKind.DeclarationPattern or SyntaxKind.RecursivePattern); 558when canConvertToSubpattern(name, arg) && !memberAccess.Expression.IsKind(SyntaxKind.BaseExpression):
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (6)
68if (token.Kind() is not (SyntaxKind.OpenParenToken or SyntaxKind.CommaToken)) 111if (token.Kind() == SyntaxKind.CommaToken && token.Parent is AttributeArgumentListSyntax argumentList) 133if (token.Kind() == SyntaxKind.CommaToken && token.Parent is AttributeArgumentListSyntax argumentList) 161var displayTextSuffix = rightToken.IsKind(SyntaxKind.EqualsToken) ? null : SpaceEqualsString; 183var displayTextSuffix = rightToken.IsKind(SyntaxKind.ColonToken) ? null : ColonString;
Completion\CompletionProviders\AwaitCompletionProvider.cs (3)
81if (existingReturnType is PredefinedTypeSyntax { Keyword: (kind: SyntaxKind.VoidKeyword) }) 138if (node?.Parent is AssignmentExpressionSyntax(kind: SyntaxKind.AddAssignmentExpression or SyntaxKind.SubtractAssignmentExpression) assignment)
Completion\CompletionProviders\CompletionUtilities.cs (9)
34if (token.Kind() == SyntaxKind.DotToken) 38if (token.Kind() == SyntaxKind.DotDotToken && token.SpanStart == characterPosition) 54if (dotToken.GetPreviousToken().Kind() == SyntaxKind.NumericLiteralToken) 167symbol.DeclaringSyntaxReferences[0].GetSyntax().Kind() == SyntaxKind.DefaultSwitchLabel) 327if (tokenLeftOfGenericName.IsKind(SyntaxKind.DotToken) && tokenLeftOfGenericName.Parent.IsKind(SyntaxKind.QualifiedName)) 341if (prevToken.Kind() is SyntaxKind.RefKeyword or SyntaxKind.ReadOnlyKeyword && prevToken.Parent.IsKind(SyntaxKind.RefType))
Completion\CompletionProviders\CrefCompletionProvider.cs (15)
120return token.Kind() is SyntaxKind.DoubleQuoteToken or SyntaxKind.SingleQuoteToken && 121token.Parent.IsKind(SyntaxKind.XmlCrefAttribute); 136if (token.Parent?.Kind() is not (SyntaxKind.CrefParameterList or SyntaxKind.CrefBracketedParameterList)) 139if (token.IsKind(SyntaxKind.OpenParenToken) && 140token.Parent.IsKind(SyntaxKind.CrefParameterList)) 145if (token.IsKind(SyntaxKind.OpenBracketToken) && 146token.Parent.IsKind(SyntaxKind.CrefBracketedParameterList)) 151return token is (kind: SyntaxKind.CommaToken or SyntaxKind.RefKeyword or SyntaxKind.OutKeyword); 159return token.IsKind(SyntaxKind.DotToken) 160&& token.Parent.IsKind(SyntaxKind.QualifiedCref); 275if (symbol is INamespaceOrTypeSymbol && token.IsKind(SyntaxKind.DotToken))
Completion\CompletionProviders\CSharpSuggestionModeCompletionProvider.cs (25)
41if (token.Kind() == SyntaxKind.None) 62else if (token.IsKindOrHasMatchingText(SyntaxKind.FromKeyword) || token.IsKindOrHasMatchingText(SyntaxKind.JoinKeyword)) 74case SyntaxKind.ClassKeyword: 77case SyntaxKind.StructKeyword: 80case SyntaxKind.InterfaceKeyword: 100return token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken; 109if (token.IsKind(SyntaxKind.NewKeyword) && token.Parent.IsKind(SyntaxKind.ObjectCreationExpression)) 117if (token.Kind() == SyntaxKind.LessThanToken && token.Parent is BinaryExpressionSyntax) 123if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 143if (token.Kind() == SyntaxKind.OpenParenToken && 144token.GetRequiredParent().Kind() == SyntaxKind.ParenthesizedExpression) 151if (token.Kind() == SyntaxKind.OpenParenToken && 152token.GetRequiredParent().Kind() == SyntaxKind.CastExpression) 161if (previousToken.IsKind(SyntaxKind.DotToken) && 162previousToken.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 170if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.ArgumentList) 174if (identifier.Identifier.IsKindOrHasMatchingText(SyntaxKind.AsyncKeyword)) 219if (current.IsKind(SyntaxKind.OrPattern)) 225if (current.IsKind(SyntaxKind.NotPattern))
Completion\CompletionProviders\DeclarationName\DeclarationNameCompletionProvider.cs (2)
61if (context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.AsyncKeyword) || 62context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.YieldKeyword))
Completion\CompletionProviders\DeclarationName\DeclarationNameInfo.cs (37)
122if (token.GetAncestor(node => node.IsKind(SyntaxKind.TupleExpression)) != null) 206if (token.IsKind(SyntaxKind.IdentifierToken) && 207token.Parent.IsKind(SyntaxKind.IdentifierName)) 213if (argument is { RefOrOutKeyword: SyntaxToken(SyntaxKind.OutKeyword) }) 294var afterComma = token.IsKind(SyntaxKind.CommaToken); 424var possibleDeclarationComputer = token.IsKind(SyntaxKind.CommaToken) 444if (token.IsKind(SyntaxKind.QuestionToken) && 496if (token.Kind() is SyntaxKind.LessThanToken or SyntaxKind.CommaToken && 497token.Parent.IsKind(SyntaxKind.TypeParameterList)) 521token.GetAncestor<ParameterSyntax>()?.Parent?.Parent is (kind: SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration)) 551if (token.Kind() is SyntaxKind.GreaterThanToken && 557if (parent.IsParentKind(SyntaxKind.IsExpression)) 566else if (parent.IsParentKind(SyntaxKind.CaseSwitchLabel)) 575else if (parent.IsParentKind(SyntaxKind.DeclarationPattern)) 590SyntaxKind.IdentifierToken or 591SyntaxKind.GreaterThanToken or 592SyntaxKind.CloseBracketToken or 593SyntaxKind.QuestionToken || 594token.Parent.IsKind(SyntaxKind.PredefinedType); 640case SyntaxKind.StaticKeyword: 643case SyntaxKind.AbstractKeyword: 646case SyntaxKind.NewKeyword: 649case SyntaxKind.UnsafeKeyword: 652case SyntaxKind.ReadOnlyKeyword: 655case SyntaxKind.VirtualKeyword: 658case SyntaxKind.OverrideKeyword: 661case SyntaxKind.SealedKeyword: 664case SyntaxKind.ConstKeyword: 667case SyntaxKind.AsyncKeyword: 670case SyntaxKind.PartialKeyword: 686case SyntaxKind.PrivateKeyword: 688case SyntaxKind.PublicKeyword: 690case SyntaxKind.ProtectedKeyword: 692case SyntaxKind.InternalKeyword: 704case SyntaxKind.DeclarationExpression:
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (1)
303var parameterSyntax = context.LeftToken.GetAncestor(n => n.IsKind(SyntaxKind.Parameter)) as ParameterSyntax;
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (4)
83if (token.IsKind(SyntaxKind.DotToken)) 279if (token.Kind() is SyntaxKind.BarToken or 280SyntaxKind.AmpersandToken or 281SyntaxKind.CaretToken)
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.cs (8)
80var kind = ancestor.Kind(); 83case SyntaxKind.EventFieldDeclaration: 84case SyntaxKind.EventDeclaration: 85case SyntaxKind.PropertyDeclaration: 86case SyntaxKind.IndexerDeclaration: 87case SyntaxKind.OperatorDeclaration: 88case SyntaxKind.ConversionOperatorDeclaration: 89case SyntaxKind.MethodDeclaration:
Completion\CompletionProviders\ExplicitInterfaceMemberCompletionProvider.ItemGetter.cs (1)
90when node.Parent.IsKind(SyntaxKind.IncompleteMember):
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (12)
70if (SyntaxFacts.GetContextualKeywordKind(targetToken.ValueText) == SyntaxKind.AsyncKeyword) 74if (targetToken.IsKind(SyntaxKind.GreaterThanToken) && potentialTypeNode is TypeArgumentListSyntax typeArgumentList) 123while (tokenBeforeType.Kind() is SyntaxKind.AsyncKeyword or SyntaxKind.StaticKeyword) 127if (tokenBeforeType.Kind() == SyntaxKind.OpenBraceToken) 130if (tokenBeforeType.Kind() is SyntaxKind.CloseBraceToken or SyntaxKind.SemicolonToken) 142=> node.Kind() is SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration or 143SyntaxKind.InterfaceDeclaration or SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration;
Completion\CompletionProviders\ExternAliasCompletionProvider.cs (6)
58if (!targetToken.IsKind(SyntaxKind.AliasKeyword) 59&& !(targetToken.IsKind(SyntaxKind.IdentifierToken) && targetToken.HasMatchingText(SyntaxKind.AliasKeyword))) 64if (targetToken.Parent.IsKind(SyntaxKind.ExternAliasDirective) 65|| (targetToken.Parent.IsKind(SyntaxKind.IdentifierName) && targetToken.Parent.IsParentKind(SyntaxKind.IncompleteMember)))
Completion\CompletionProviders\FunctionPointerUnmanagedCallingConventionCompletionProvider.cs (2)
61if (token.Kind() is not (SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken))
Completion\CompletionProviders\ImportCompletion\ExtensionMemberImportCompletionProvider.cs (1)
38if (token.IsKind(SyntaxKind.None) || token.IsMissing)
Completion\CompletionProviders\ImportCompletion\TypeImportCompletionProvider.cs (1)
40if (token.IsKind(SyntaxKind.None) || token.IsMissing)
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (4)
64if (token.Kind() is not (SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken)) 194var type = constructorInitializer.Kind() == SyntaxKind.BaseConstructorInitializer
Completion\CompletionProviders\ObjectAndWithInitializerCompletionProvider.cs (12)
102if (token.Kind() is not SyntaxKind.CommaToken and not SyntaxKind.OpenBraceToken) 109if (token.Kind() == SyntaxKind.CommaToken && 110token.Parent.Kind() is not (SyntaxKind.ObjectInitializerExpression or SyntaxKind.WithInitializerExpression)) 119return (type, token.GetLocation(), token.Parent.Kind() is not SyntaxKind.WithInitializerExpression); 128if (parent is (kind: SyntaxKind.ObjectCreationExpression or SyntaxKind.ImplicitObjectCreationExpression)) 134if (parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 157if (token.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenBraceToken && 161.Where(b => b.OperatorToken.Kind() == SyntaxKind.EqualsToken)
Completion\CompletionProviders\ObjectCreationCompletionProvider.cs (1)
51if (newToken.Kind() == SyntaxKind.NewKeyword)
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider.cs (2)
84var expression = dotToken.Kind() == SyntaxKind.DotToken 189var questionToken = dotToken.GetPreviousToken().Kind() == SyntaxKind.QuestionToken
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Conversions.cs (1)
84var questionToken = dotToken.GetPreviousToken().Kind() == SyntaxKind.QuestionToken
Completion\CompletionProviders\OperatorsAndIndexer\UnnamedSymbolCompletionProvider_Operators.cs (1)
147dotLikeToken.Kind() == SyntaxKind.DotDotToken ? dotLikeToken.Span.Start + 1 : dotLikeToken.Span.End),
Completion\CompletionProviders\OverrideCompletionProvider.cs (12)
59identifierName.Identifier.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 100if (token.Kind() == SyntaxKind.CloseBracketToken) 118case SyntaxKind.AbstractKeyword: 121case SyntaxKind.ExternKeyword: 124case SyntaxKind.OverrideKeyword: 127case SyntaxKind.RequiredKeyword: 130case SyntaxKind.SealedKeyword: 133case SyntaxKind.UnsafeKeyword: 139case SyntaxKind.PublicKeyword: 144case SyntaxKind.PrivateKeyword: 153case SyntaxKind.InternalKeyword: 162case SyntaxKind.ProtectedKeyword:
Completion\CompletionProviders\PartialMethodCompletionProvider.cs (14)
37case SyntaxKind.PublicKeyword: 38case SyntaxKind.ProtectedKeyword: 39case SyntaxKind.InternalKeyword: 40case SyntaxKind.PrivateKeyword: 79return declarations.Any(d => d.Body == null && d.Modifiers.Any(SyntaxKind.PartialKeyword)); 92if (targetToken.Kind() is SyntaxKind.VoidKeyword or SyntaxKind.PartialKeyword || 93(targetToken.Kind() == SyntaxKind.IdentifierToken && targetToken.HasMatchingText(SyntaxKind.PartialKeyword))) 107var foundPartial = touchingToken.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword); 112if (token.IsKindOrHasMatchingText(SyntaxKind.AsyncKeyword)) 117foundPartial = foundPartial || token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword); 129return !syntaxToken.IsKind(SyntaxKind.None) 130&& !touchingToken.IsKind(SyntaxKind.None)
Completion\CompletionProviders\PartialTypeCompletionProvider.cs (1)
73=> syntax is BaseTypeDeclarationSyntax declarationSyntax && declarationSyntax.Modifiers.Any(SyntaxKind.PartialKeyword);
Completion\CompletionProviders\PropertySubPatternCompletionProvider.cs (4)
190if (token.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenBraceToken) 197if (token.IsKind(SyntaxKind.DotToken)) 210while (memberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression))
Completion\CompletionProviders\Scripting\DirectiveCompletionProviderUtilities.cs (4)
12internal static bool TryGetStringLiteralToken(SyntaxTree tree, int position, SyntaxKind directiveKind, out SyntaxToken stringLiteral, CancellationToken cancellationToken) 17if (token.Kind() is SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken) 22if (token.Kind() == SyntaxKind.StringLiteralToken && token.Parent!.Kind() == directiveKind)
Completion\CompletionProviders\Scripting\LoadDirectiveCompletionProvider.cs (1)
29=> DirectiveCompletionProviderUtilities.TryGetStringLiteralToken(tree, position, SyntaxKind.LoadDirectiveTrivia, out stringLiteral, cancellationToken);
Completion\CompletionProviders\Scripting\ReferenceDirectiveCompletionProvider.cs (1)
28=> DirectiveCompletionProviderUtilities.TryGetStringLiteralToken(tree, position, SyntaxKind.ReferenceDirectiveTrivia, out stringLiteral, cancellationToken);
Completion\CompletionProviders\SnippetCompletionProvider.cs (11)
127SyntaxKind.IfKeyword or 128SyntaxKind.RegionKeyword or 129SyntaxKind.ElseKeyword or 130SyntaxKind.ElifKeyword or 131SyntaxKind.ErrorKeyword or 132SyntaxKind.LineKeyword or 133SyntaxKind.PragmaKeyword or 134SyntaxKind.EndIfKeyword or 135SyntaxKind.UndefKeyword or 136SyntaxKind.EndRegionKeyword or 137SyntaxKind.WarningKeyword))
Completion\CompletionProviders\SymbolCompletionProvider.cs (6)
113=> context.TargetToken.Parent?.Parent?.IsKind(SyntaxKind.PrimaryConstructorBaseType) is true; 171return token.GetPreviousToken().Kind() != SyntaxKind.NumericLiteralToken; 186if (token.Parent?.Kind() is not (SyntaxKind.ArgumentList or SyntaxKind.BracketedArgumentList or SyntaxKind.AttributeArgumentList or SyntaxKind.ArrayRankSpecifier))
Completion\CompletionProviders\TupleNameCompletionProvider.cs (5)
75if (token.IsKind(SyntaxKind.OpenParenToken)) 77if (token.Parent is (kind: SyntaxKind.ParenthesizedExpression or SyntaxKind.TupleExpression or SyntaxKind.CastExpression)) 83if (token.IsKind(SyntaxKind.CommaToken) && token.Parent is TupleExpressionSyntax tupleExpr)
Completion\CompletionProviders\XmlDocCommentCompletionProvider.cs (25)
46foreach (var keywordKind in SyntaxFacts.GetKeywordKinds()) 85if (attachedToken.Kind() == SyntaxKind.None) 111addEqualsAndQuotes: !nextToken.IsKind(SyntaxKind.EqualsToken) || nextToken.HasLeadingTrivia); 142if (token.Parent?.Kind() is SyntaxKind.XmlEmptyElement or SyntaxKind.XmlText || 143(token.Parent.IsKind(SyntaxKind.XmlElementEndTag) && token.IsKind(SyntaxKind.GreaterThanToken)) || 144(token.Parent.IsKind(SyntaxKind.XmlName) && token.Parent.IsParentKind(SyntaxKind.XmlEmptyElement))) 147if (token.Parent.IsParentKind(SyntaxKind.XmlElement) || 148token.Parent.Parent.IsParentKind(SyntaxKind.XmlElement)) 154var xmlNameOnly = token.IsKind(SyntaxKind.LessThanToken) 155|| (token.Parent.IsKind(SyntaxKind.XmlName) && !token.HasLeadingTrivia); 166if (token.Parent.IsParentKind(SyntaxKind.XmlEmptyElement) && 173(token.Parent.Parent.IsKind(SyntaxKind.XmlEmptyElement) && token.Parent.Parent.Parent is DocumentationCommentTriviaSyntax)) 215if (token.IsKind(SyntaxKind.XmlTextLiteralToken) && string.IsNullOrWhiteSpace(token.Text)) 231if (token.IsKind(SyntaxKind.IdentifierToken) && token.Parent.IsKind(SyntaxKind.XmlName)) 238SyntaxKind.XmlCrefAttribute or 239SyntaxKind.XmlNameAttribute or 240SyntaxKind.XmlTextAttribute) attributeSyntax) 293if (token.Parent.IsKind(SyntaxKind.IdentifierName) && 299else if (token.IsKind(SyntaxKind.XmlTextLiteralToken) && 305else if (token.Parent.IsKind(SyntaxKind.XmlNameAttribute, out attributeSyntax) || 306token.Parent.IsKind(SyntaxKind.XmlTextAttribute, out attributeSyntax))
Completion\KeywordRecommenders\AbstractKeywordRecommender.cs (29)
12internal sealed class AbstractKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AbstractKeyword) 14private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.ExternKeyword, 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.PublicKeyword, 20SyntaxKind.ProtectedKeyword, 21SyntaxKind.UnsafeKeyword, 22SyntaxKind.OverrideKeyword, 25private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 27SyntaxKind.ExternKeyword, 28SyntaxKind.InternalKeyword, 29SyntaxKind.NewKeyword, 30SyntaxKind.PublicKeyword, 31SyntaxKind.ProtectedKeyword, 32SyntaxKind.StaticKeyword, 33SyntaxKind.UnsafeKeyword, 34SyntaxKind.OverrideKeyword, 37private static readonly ISet<SyntaxKind> s_validTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 39SyntaxKind.InternalKeyword, 40SyntaxKind.NewKeyword, 41SyntaxKind.PublicKeyword, 42SyntaxKind.PrivateKeyword, 43SyntaxKind.ProtectedKeyword, 44SyntaxKind.UnsafeKeyword, 45SyntaxKind.FileKeyword,
Completion\KeywordRecommenders\AbstractSpecialTypePreselectingKeywordRecommender.cs (5)
16SyntaxKind keywordKind, 44if (!syntaxTree.IsAfterKeyword(position, SyntaxKind.RefKeyword, cancellationToken) && 45!syntaxTree.IsAfterKeyword(position, SyntaxKind.ReadOnlyKeyword, cancellationToken)) 54if (token.Kind() is SyntaxKind.ReadOnlyKeyword) 58if (token.Kind() != SyntaxKind.RefKeyword)
Completion\KeywordRecommenders\AbstractSyntacticSingleKeywordRecommender.cs (3)
15public readonly SyntaxKind KeywordKind; 29SyntaxKind keywordKind, 62private SyntaxKind? RecommendKeyword(int position, CSharpSyntaxContext context, CancellationToken cancellationToken)
Completion\KeywordRecommenders\AddKeywordRecommender.cs (2)
11internal sealed class AddKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AddKeyword) 14=> context.TargetToken.IsAccessorDeclarationContext<EventDeclarationSyntax>(position, SyntaxKind.AddKeyword);
Completion\KeywordRecommenders\AliasKeywordRecommender.cs (2)
12internal sealed class AliasKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AliasKeyword) 21if (token.Kind() == SyntaxKind.ExternKeyword)
Completion\KeywordRecommenders\AllowsKeywordRecommender.cs (3)
12internal sealed class AllowsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AllowsKeyword) 35if (token.Kind() == SyntaxKind.CommaToken && 40.Any(c => c.ClassOrStructKeyword.Kind() == SyntaxKind.ClassKeyword))
Completion\KeywordRecommenders\AndKeywordRecommender.cs (1)
10internal sealed class AndKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AndKeyword)
Completion\KeywordRecommenders\AnnotationsKeywordRecommender.cs (6)
11: AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AnnotationsKeyword, isValidInPreprocessorContext: true) 22(previousToken1.Kind() == SyntaxKind.EnableKeyword || previousToken1.Kind() == SyntaxKind.DisableKeyword || previousToken1.Kind() == SyntaxKind.RestoreKeyword) && 23previousToken2.Kind() == SyntaxKind.NullableKeyword && 24previousToken3.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\AscendingKeywordRecommender.cs (1)
10internal sealed class AscendingKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AscendingKeyword)
Completion\KeywordRecommenders\AsKeywordRecommender.cs (1)
10internal sealed class AsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AsKeyword)
Completion\KeywordRecommenders\AssemblyKeywordRecommender.cs (3)
12internal sealed class AssemblyKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AssemblyKeyword) 18if (token.Kind() == SyntaxKind.OpenBracketToken && 19token.GetRequiredParent().Kind() == SyntaxKind.AttributeList)
Completion\KeywordRecommenders\AsyncKeywordRecommender.cs (8)
13internal sealed class AsyncKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.AsyncKeyword, isValidInPreprocessorContext: false) 15private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.StaticKeyword, 18SyntaxKind.UnsafeKeyword 23if (context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword) || 24context.PrecedingModifiers.Contains(SyntaxKind.AsyncKeyword)) 30|| context.SyntaxTree.IsLambdaDeclarationContext(position, otherModifier: SyntaxKind.StaticKeyword, cancellationToken)
Completion\KeywordRecommenders\BaseKeywordRecommender.cs (6)
13internal sealed class BaseKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.BaseKeyword) 46if (token.Kind() == SyntaxKind.ColonToken && 48token.Parent.IsParentKind(SyntaxKind.ConstructorDeclaration) && 49token.Parent.Parent?.Parent is (kind: SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration)) 52if (constructor.Modifiers.Any(SyntaxKind.StaticKeyword))
Completion\KeywordRecommenders\BoolKeywordRecommender.cs (3)
14internal sealed class BoolKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.BoolKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 38syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\BreakKeywordRecommender.cs (1)
13internal sealed class BreakKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.BreakKeyword)
Completion\KeywordRecommenders\ByKeywordRecommender.cs (2)
13internal sealed class ByKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ByKeyword) 40token.Kind() == SyntaxKind.IdentifierToken &&
Completion\KeywordRecommenders\ByteKeywordRecommender.cs (3)
14internal sealed class ByteKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.ByteKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\CaseKeywordRecommender.cs (2)
12internal sealed class CaseKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.CaseKeyword) 25if (token.Kind() == SyntaxKind.GotoKeyword &&
Completion\KeywordRecommenders\CatchKeywordRecommender.cs (1)
10internal sealed class CatchKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.CatchKeyword)
Completion\KeywordRecommenders\CharKeywordRecommender.cs (3)
14internal sealed class CharKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.CharKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 38syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\CheckedKeywordRecommender.cs (3)
13internal sealed class CheckedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.CheckedKeyword) 26if (targetToken.Kind() == SyntaxKind.OperatorKeyword) 53if (previousToken.Kind() == SyntaxKind.ExplicitKeyword)
Completion\KeywordRecommenders\ChecksumKeywordRecommender.cs (3)
10internal sealed class ChecksumKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ChecksumKeyword, isValidInPreprocessorContext: true) 20previousToken1.Kind() == SyntaxKind.PragmaKeyword && 21previousToken2.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\ClassKeywordRecommender.cs (14)
12internal sealed class ClassKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ClassKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.NewKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ProtectedKeyword, 19SyntaxKind.InternalKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.AbstractKeyword, 22SyntaxKind.ClosedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.FileKeyword,
Completion\KeywordRecommenders\ClosedKeywordRecommender.cs (8)
14internal sealed class ClosedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ClosedKeyword) 16private static readonly ISet<SyntaxKind> s_validModifiers = SyntaxKindSet.AllTypeModifiers 17.Where(s => s is not (SyntaxKind.ClosedKeyword or SyntaxKind.AbstractKeyword or SyntaxKind.SealedKeyword or SyntaxKind.StaticKeyword or SyntaxKind.ReadOnlyKeyword or SyntaxKind.RefKeyword))
Completion\KeywordRecommenders\ConstKeywordRecommender.cs (14)
12internal sealed class ConstKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ConstKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.NewKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ProtectedKeyword, 19SyntaxKind.InternalKeyword, 20SyntaxKind.PrivateKeyword, 23private static readonly ISet<SyntaxKind> s_validGlobalModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 25SyntaxKind.NewKeyword, 26SyntaxKind.PublicKeyword, 27SyntaxKind.InternalKeyword, 28SyntaxKind.PrivateKeyword,
Completion\KeywordRecommenders\ContinueKeywordRecommender.cs (1)
13internal sealed class ContinueKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ContinueKeyword)
Completion\KeywordRecommenders\DecimalKeywordRecommender.cs (3)
14internal sealed class DecimalKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.DecimalKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 38syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\DefaultKeywordRecommender.cs (3)
10internal sealed class DefaultKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DefaultKeyword, isValidInPreprocessorContext: true) 35previousToken1.Kind() == SyntaxKind.LineKeyword && 36previousToken2.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\DefineKeywordRecommender.cs (1)
11internal sealed class DefineKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DefineKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\DelegateKeywordRecommender.cs (9)
13internal sealed class DelegateKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DelegateKeyword) 15private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.InternalKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.PrivateKeyword, 20SyntaxKind.ProtectedKeyword, 21SyntaxKind.UnsafeKeyword 59context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.AsyncKeyword) &&
Completion\KeywordRecommenders\DescendingKeywordRecommender.cs (1)
10internal sealed class DescendingKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DescendingKeyword)
Completion\KeywordRecommenders\DisableKeywordRecommender.cs (6)
10internal sealed class DisableKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DisableKeyword, isValidInPreprocessorContext: true) 18if (previousToken1.Kind() == SyntaxKind.NullableKeyword && 19previousToken2.Kind() == SyntaxKind.HashToken) 29previousToken1.Kind() == SyntaxKind.WarningKeyword && 30previousToken2.Kind() == SyntaxKind.PragmaKeyword && 31previousToken3.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\DoKeywordRecommender.cs (1)
10internal sealed class DoKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.DoKeyword)
Completion\KeywordRecommenders\DoubleKeywordRecommender.cs (3)
14internal sealed class DoubleKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.DoubleKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 38syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\DynamicKeywordRecommender.cs (4)
55syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 72=> context.TargetToken.Kind() is SyntaxKind.RefKeyword or SyntaxKind.ReadOnlyKeyword && 73context.TargetToken.Parent.IsKind(SyntaxKind.RefType);
Completion\KeywordRecommenders\ElifKeywordRecommender.cs (1)
10internal sealed class ElifKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ElifKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\ElseKeywordRecommender.cs (1)
12internal sealed class ElseKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ElseKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\EnableKeywordRecommender.cs (6)
10internal sealed class EnableKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EnableKeyword, isValidInPreprocessorContext: true) 19if (previousToken1.Kind() == SyntaxKind.NullableKeyword && 20previousToken2.Kind() == SyntaxKind.HashToken) 30previousToken1.Kind() == SyntaxKind.WarningKeyword && 31previousToken2.Kind() == SyntaxKind.PragmaKeyword && 32previousToken3.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\EndIfKeywordRecommender.cs (1)
10internal sealed class EndIfKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EndIfKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\EndRegionKeywordRecommender.cs (1)
10internal sealed class EndRegionKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EndRegionKeyword, isValidInPreprocessorContext: true, shouldFormatOnCommit: true)
Completion\KeywordRecommenders\EnumKeywordRecommender.cs (7)
12internal sealed class EnumKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EnumKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.InternalKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.PrivateKeyword, 19SyntaxKind.ProtectedKeyword,
Completion\KeywordRecommenders\EqualsKeywordRecommender.cs (1)
12internal sealed class EqualsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EqualsKeyword)
Completion\KeywordRecommenders\ErrorKeywordRecommender.cs (1)
10internal sealed class ErrorKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ErrorKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\EventKeywordRecommender.cs (18)
13internal sealed class EventKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.EventKeyword) 15private static readonly ISet<SyntaxKind> s_validClassModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.NewKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.InternalKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.StaticKeyword, 23SyntaxKind.VirtualKeyword, 24SyntaxKind.SealedKeyword, 25SyntaxKind.OverrideKeyword, 26SyntaxKind.AbstractKeyword, 27SyntaxKind.ExternKeyword, 28SyntaxKind.UnsafeKeyword 31private static readonly ISet<SyntaxKind> s_validStructModifiers = new HashSet<SyntaxKind>(s_validClassModifiers, SyntaxFacts.EqualityComparer) 33SyntaxKind.ReadOnlyKeyword,
Completion\KeywordRecommenders\ExplicitKeywordRecommender.cs (17)
12internal sealed class ExplicitKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ExplicitKeyword) 14private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.StaticKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ExternKeyword, 19SyntaxKind.UnsafeKeyword, 22private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 24SyntaxKind.StaticKeyword, 25SyntaxKind.PublicKeyword, 26SyntaxKind.AbstractKeyword, 27SyntaxKind.UnsafeKeyword, 38modifiers.Contains(SyntaxKind.PublicKeyword) && 39modifiers.Contains(SyntaxKind.StaticKeyword); 47modifiers.Contains(SyntaxKind.AbstractKeyword) && 48modifiers.Contains(SyntaxKind.StaticKeyword);
Completion\KeywordRecommenders\ExtensionKeywordRecommender.cs (7)
11internal sealed class ExtensionKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ExtensionKeyword) 13private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer); 14private static readonly ISet<SyntaxKind> s_validTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.ClassDeclaration 22context.ContainingTypeDeclaration?.Modifiers.Any(SyntaxKind.StaticKeyword) is true &&
Completion\KeywordRecommenders\ExternKeywordRecommender.cs (32)
13internal sealed class ExternKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ExternKeyword) 15private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.OverrideKeyword, 20SyntaxKind.PublicKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.ProtectedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.VirtualKeyword, 29private static readonly ISet<SyntaxKind> s_validGlobalModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 31SyntaxKind.InternalKeyword, 32SyntaxKind.NewKeyword, 33SyntaxKind.PublicKeyword, 34SyntaxKind.PrivateKeyword, 35SyntaxKind.StaticKeyword, 36SyntaxKind.UnsafeKeyword, 39private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 41SyntaxKind.StaticKeyword, 42SyntaxKind.UnsafeKeyword 79if (token.Kind() == SyntaxKind.None) 85if (token.Kind() == SyntaxKind.OpenBraceToken && 86token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 93if (token.Kind() == SyntaxKind.SemicolonToken && 94token.Parent.IsKind(SyntaxKind.FileScopedNamespaceDeclaration)) 101if (token.Kind() == SyntaxKind.SemicolonToken && 102token.Parent.IsKind(SyntaxKind.ExternAliasDirective))
Completion\KeywordRecommenders\FalseKeywordRecommender.cs (1)
10internal sealed class FalseKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FalseKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\FieldKeywordRecommender.cs (8)
13: AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FieldKeyword) 16private static readonly ISet<SyntaxKind> s_validTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 18SyntaxKind.StructDeclaration, 19SyntaxKind.ClassDeclaration, 20SyntaxKind.RecordDeclaration, 21SyntaxKind.RecordStructDeclaration, 22SyntaxKind.EnumDeclaration,
Completion\KeywordRecommenders\FileKeywordRecommender.cs (4)
14internal sealed class FileKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FileKeyword) 16private static readonly ISet<SyntaxKind> s_validModifiers = SyntaxKindSet.AllMemberModifiers 17.Where(s => s != SyntaxKind.FileKeyword && s != SyntaxKind.ExternKeyword && !SyntaxFacts.IsAccessibilityModifier(s))
Completion\KeywordRecommenders\FinallyKeywordRecommender.cs (1)
10internal sealed class FinallyKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FinallyKeyword)
Completion\KeywordRecommenders\FixedKeywordRecommender.cs (9)
12internal sealed class FixedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FixedKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.NewKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ProtectedKeyword, 19SyntaxKind.InternalKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.UnsafeKeyword,
Completion\KeywordRecommenders\FloatKeywordRecommender.cs (3)
14internal sealed class FloatKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.FloatKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 38syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\ForEachKeywordRecommender.cs (1)
10internal sealed class ForEachKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ForEachKeyword)
Completion\KeywordRecommenders\ForKeywordRecommender.cs (1)
10internal sealed class ForKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ForKeyword)
Completion\KeywordRecommenders\FromKeywordRecommender.cs (1)
10internal sealed class FromKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.FromKeyword)
Completion\KeywordRecommenders\GetKeywordRecommender.cs (3)
11internal sealed class GetKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.GetKeyword) 16context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.GetKeyword) || 17context.TargetToken.IsAccessorDeclarationContext<IndexerDeclarationSyntax>(position, SyntaxKind.GetKeyword);
Completion\KeywordRecommenders\GlobalKeywordRecommender.cs (1)
12internal sealed class GlobalKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.GlobalKeyword)
Completion\KeywordRecommenders\GotoKeywordRecommender.cs (1)
10internal sealed class GotoKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.GotoKeyword)
Completion\KeywordRecommenders\GroupKeywordRecommender.cs (1)
11internal sealed class GroupKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.GroupKeyword)
Completion\KeywordRecommenders\HiddenKeywordRecommender.cs (3)
10internal sealed class HiddenKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.HiddenKeyword, isValidInPreprocessorContext: true) 24previousToken1.Kind() == SyntaxKind.LineKeyword && 25previousToken2.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\IfKeywordRecommender.cs (1)
10internal sealed class IfKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.IfKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\ImplicitKeywordRecommender.cs (17)
12internal sealed class ImplicitKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ImplicitKeyword) 14private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.StaticKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ExternKeyword, 19SyntaxKind.UnsafeKeyword, 22private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 24SyntaxKind.StaticKeyword, 25SyntaxKind.PublicKeyword, 26SyntaxKind.AbstractKeyword, 27SyntaxKind.UnsafeKeyword, 38modifiers.Contains(SyntaxKind.PublicKeyword) && 39modifiers.Contains(SyntaxKind.StaticKeyword); 47modifiers.Contains(SyntaxKind.AbstractKeyword) && 48modifiers.Contains(SyntaxKind.StaticKeyword);
Completion\KeywordRecommenders\InitKeywordRecommender.cs (3)
11internal sealed class InitKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.InitKeyword) 16context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.InitKeyword) || 17context.TargetToken.IsAccessorDeclarationContext<IndexerDeclarationSyntax>(position, SyntaxKind.InitKeyword);
Completion\KeywordRecommenders\InKeywordRecommender.cs (10)
13internal sealed class InKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.InKeyword) 32position, context.LeftToken, includeOperators: true, out var parameterIndex, out var previousModifier)) 34if (previousModifier is SyntaxKind.None or SyntaxKind.ScopedKeyword) 39if (previousModifier == SyntaxKind.ThisKeyword && 59if (token.Kind() == SyntaxKind.IdentifierToken) 66else if (token.Kind() == SyntaxKind.CloseParenToken) 82if (token.Kind() == SyntaxKind.IdentifierToken) 86if (token.GetPreviousToken(includeSkipped: true).IsKindOrHasMatchingText(SyntaxKind.FromKeyword)) 113if (token.Kind() == SyntaxKind.IdentifierToken)
Completion\KeywordRecommenders\InterfaceKeywordRecommender.cs (8)
12internal sealed class InterfaceKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.InterfaceKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.InternalKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.PrivateKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.UnsafeKeyword
Completion\KeywordRecommenders\InternalKeywordRecommender.cs (5)
12internal sealed class InternalKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.InternalKeyword) 60!precedingModifiers.Contains(SyntaxKind.FileKeyword) && 61!precedingModifiers.Contains(SyntaxKind.PublicKeyword) && 62!precedingModifiers.Contains(SyntaxKind.InternalKeyword) && 63!precedingModifiers.Contains(SyntaxKind.PrivateKeyword);
Completion\KeywordRecommenders\IntKeywordRecommender.cs (3)
14internal sealed class IntKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.IntKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\IntoKeywordRecommender.cs (2)
13internal sealed class IntoKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.IntoKeyword) 42if (lastCompleteToken.Kind() == SyntaxKind.DotToken)
Completion\KeywordRecommenders\IsKeywordRecommender.cs (1)
10internal sealed class IsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.IsKeyword)
Completion\KeywordRecommenders\JoinKeywordRecommender.cs (1)
10internal sealed class JoinKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.JoinKeyword)
Completion\KeywordRecommenders\LetKeywordRecommender.cs (1)
11internal sealed class LetKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.LetKeyword)
Completion\KeywordRecommenders\LineKeywordRecommender.cs (1)
10internal sealed class LineKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.LineKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\LoadKeywordRecommender.cs (1)
11internal sealed class LoadKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.LoadKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\LockKeywordRecommender.cs (1)
10internal sealed class LockKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.LockKeyword)
Completion\KeywordRecommenders\LongKeywordRecommender.cs (3)
14internal sealed class LongKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.LongKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\ManagedKeywordRecommender.cs (1)
10internal sealed class ManagedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ManagedKeyword)
Completion\KeywordRecommenders\MethodKeywordRecommender.cs (4)
13internal sealed class MethodKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.MethodKeyword) 22if (token.Kind() == SyntaxKind.OpenBracketToken) 30or TypeDeclarationSyntax(kind: SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration) { ParameterList: not null }
Completion\KeywordRecommenders\ModuleKeywordRecommender.cs (2)
13internal sealed class ModuleKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ModuleKeyword) 22return type == null || type.IsParentKind(SyntaxKind.CompilationUnit);
Completion\KeywordRecommenders\NameOfKeywordRecommender.cs (1)
10internal sealed class NameOfKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NameOfKeyword)
Completion\KeywordRecommenders\NamespaceKeywordRecommender.cs (16)
13internal sealed class NamespaceKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NamespaceKeyword) 80(nextToken.Kind() == SyntaxKind.GlobalKeyword && nextToken.GetAncestor<UsingDirectiveSyntax>()?.GlobalKeyword == nextToken)) 86if (token.Kind() == SyntaxKind.None) 99if (token.Kind() == SyntaxKind.OpenBraceToken && 100token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 110if (token.Kind() == SyntaxKind.SemicolonToken) 112if (token.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective) && 113!token.Parent.Parent.IsKind(SyntaxKind.FileScopedNamespaceDeclaration)) 121if (token.Kind() == SyntaxKind.CloseBraceToken) 128else if (token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 137if (token.Kind() == SyntaxKind.SemicolonToken) 139if (token.Parent.IsKind(SyntaxKind.DelegateDeclaration) && 149if (token.Kind() == SyntaxKind.CloseBracketToken && 150token.Parent.IsKind(SyntaxKind.AttributeList) && 151token.Parent.IsParentKind(SyntaxKind.CompilationUnit))
Completion\KeywordRecommenders\NewKeywordRecommender.cs (27)
15internal sealed class NewKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NewKeyword) 17private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 19SyntaxKind.AbstractKeyword, 20SyntaxKind.ExternKeyword, 21SyntaxKind.InternalKeyword, 22SyntaxKind.PublicKeyword, 23SyntaxKind.PrivateKeyword, 24SyntaxKind.ProtectedKeyword, 25SyntaxKind.ReadOnlyKeyword, 26SyntaxKind.SealedKeyword, 27SyntaxKind.StaticKeyword, 28SyntaxKind.UnsafeKeyword, 29SyntaxKind.VirtualKeyword, 30SyntaxKind.VolatileKeyword, 33private static readonly ISet<SyntaxKind> ValidTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 35SyntaxKind.AbstractKeyword, 36SyntaxKind.InternalKeyword, 37SyntaxKind.PublicKeyword, 38SyntaxKind.PrivateKeyword, 39SyntaxKind.ProtectedKeyword, 40SyntaxKind.SealedKeyword, 41SyntaxKind.StaticKeyword, 42SyntaxKind.UnsafeKeyword 96if (token.Kind() == SyntaxKind.CommaToken && 101.Any(c => c.ClassOrStructKeyword.Kind() == SyntaxKind.StructKeyword))
Completion\KeywordRecommenders\NotKeywordRecommender.cs (1)
10internal sealed class NotKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NotKeyword)
Completion\KeywordRecommenders\NullableKeywordRecommender.cs (1)
10internal sealed class NullableKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NullableKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\NullKeywordRecommender.cs (1)
10internal sealed class NullKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.NullKeyword)
Completion\KeywordRecommenders\ObjectKeywordRecommender.cs (2)
14internal sealed class ObjectKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.ObjectKeyword) 37syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) ||
Completion\KeywordRecommenders\OnKeywordRecommender.cs (1)
12internal sealed class OnKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OnKeyword)
Completion\KeywordRecommenders\OperatorKeywordRecommender.cs (3)
10internal sealed class OperatorKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OperatorKeyword) 20token.Kind() is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword;
Completion\KeywordRecommenders\OrderByKeywordRecommender.cs (1)
11internal sealed class OrderByKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OrderByKeyword)
Completion\KeywordRecommenders\OrKeywordRecommender.cs (1)
10internal sealed class OrKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OrKeyword)
Completion\KeywordRecommenders\OutKeywordRecommender.cs (4)
10internal sealed class OutKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OutKeyword) 28position, context.LeftToken, includeOperators: false, out _, out var previousModifier) && 29previousModifier is SyntaxKind.None or SyntaxKind.ScopedKeyword;
Completion\KeywordRecommenders\OverrideKeywordRecommender.cs (13)
12internal sealed class OverrideKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.OverrideKeyword) 14private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.ExternKeyword, 17SyntaxKind.InternalKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.UnsafeKeyword, 22SyntaxKind.SealedKeyword, 23SyntaxKind.AbstractKeyword, 38return !modifiers.Contains(SyntaxKind.PrivateKeyword) || modifiers.Contains(SyntaxKind.ProtectedKeyword);
Completion\KeywordRecommenders\ParamKeywordRecommender.cs (5)
13internal sealed class ParamKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ParamKeyword) 15private static readonly ISet<SyntaxKind> s_validTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer); 28if (token.Kind() == SyntaxKind.OpenBracketToken && 29token.Parent.IsKind(SyntaxKind.AttributeList))
Completion\KeywordRecommenders\ParamsKeywordRecommender.cs (1)
10internal sealed class ParamsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ParamsKeyword)
Completion\KeywordRecommenders\PartialKeywordRecommender.cs (2)
15internal sealed class PartialKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.PartialKeyword) 37if (!decl.Modifiers.Any(t => t.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)))
Completion\KeywordRecommenders\PragmaKeywordRecommender.cs (1)
10internal sealed class PragmaKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.PragmaKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\PrivateKeywordRecommender.cs (9)
13internal sealed class PrivateKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.PrivateKeyword) 43if (modifiers.Contains(SyntaxKind.AbstractKeyword) || 44modifiers.Contains(SyntaxKind.VirtualKeyword) || 45modifiers.Contains(SyntaxKind.OverrideKeyword) || 46modifiers.Contains(SyntaxKind.SealedKeyword)) 79!precedingModifiers.Contains(SyntaxKind.FileKeyword) && 80!precedingModifiers.Contains(SyntaxKind.PublicKeyword) && 81!precedingModifiers.Contains(SyntaxKind.InternalKeyword) && 82!precedingModifiers.Contains(SyntaxKind.PrivateKeyword);
Completion\KeywordRecommenders\PropertyKeywordRecommender.cs (1)
11internal sealed class PropertyKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.PropertyKeyword)
Completion\KeywordRecommenders\ProtectedKeywordRecommender.cs (4)
12internal sealed class ProtectedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ProtectedKeyword) 65!precedingModifiers.Contains(SyntaxKind.FileKeyword) && 66!precedingModifiers.Contains(SyntaxKind.PublicKeyword) && 67!precedingModifiers.Contains(SyntaxKind.ProtectedKeyword);
Completion\KeywordRecommenders\PublicKeywordRecommender.cs (6)
11internal sealed class PublicKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.PublicKeyword) 50!precedingModifiers.Contains(SyntaxKind.FileKeyword) && 51!precedingModifiers.Contains(SyntaxKind.PublicKeyword) && 52!precedingModifiers.Contains(SyntaxKind.InternalKeyword) && 53!precedingModifiers.Contains(SyntaxKind.ProtectedKeyword) && 54!precedingModifiers.Contains(SyntaxKind.PrivateKeyword);
Completion\KeywordRecommenders\ReadOnlyKeywordRecommender.cs (15)
14internal sealed class ReadOnlyKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ReadOnlyKeyword) 16private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 18SyntaxKind.NewKeyword, 19SyntaxKind.PublicKeyword, 20SyntaxKind.ProtectedKeyword, 21SyntaxKind.InternalKeyword, 22SyntaxKind.PrivateKeyword, 23SyntaxKind.StaticKeyword, 42=> context.TargetToken.IsKind(SyntaxKind.RefKeyword) && 43(context.TargetToken.Parent.IsKind(SyntaxKind.RefType) || 50return context.IsTypeDeclarationContext(validModifiers: SyntaxKindSet.AllTypeModifiers.Except([SyntaxKind.ReadOnlyKeyword]).ToSet(), 58type.Kind() is SyntaxKind.StructDeclaration or SyntaxKind.RecordStructDeclaration && 59context.TargetToken.IsAnyAccessorDeclarationContext(context.Position, SyntaxKind.ReadOnlyKeyword);
Completion\KeywordRecommenders\RecordKeywordRecommender.cs (15)
12internal sealed class RecordKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RecordKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.NewKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.ProtectedKeyword, 19SyntaxKind.InternalKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.AbstractKeyword, 22SyntaxKind.ClosedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.ReadOnlyKeyword, 27SyntaxKind.FileKeyword,
Completion\KeywordRecommenders\ReferenceKeywordRecommender.cs (1)
11internal sealed class ReferenceKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ReferenceKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\RefKeywordRecommender.cs (60)
16internal sealed class RefKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RefKeyword) 21private static readonly ISet<SyntaxKind> RefMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.AbstractKeyword, 25SyntaxKind.ExternKeyword, 26SyntaxKind.InternalKeyword, 27SyntaxKind.NewKeyword, 28SyntaxKind.OverrideKeyword, 29SyntaxKind.PublicKeyword, 30SyntaxKind.PrivateKeyword, 31SyntaxKind.ProtectedKeyword, 33SyntaxKind.SealedKeyword, 34SyntaxKind.StaticKeyword, 35SyntaxKind.UnsafeKeyword, 36SyntaxKind.VirtualKeyword, 43private static readonly ISet<SyntaxKind> RefGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 46SyntaxKind.ExternKeyword, 47SyntaxKind.InternalKeyword, 48SyntaxKind.NewKeyword, 49SyntaxKind.OverrideKeyword, 50SyntaxKind.PublicKeyword, 51SyntaxKind.PrivateKeyword, 52SyntaxKind.ReadOnlyKeyword, 53SyntaxKind.StaticKeyword, 54SyntaxKind.UnsafeKeyword, 55SyntaxKind.VolatileKeyword, 61private static readonly ISet<SyntaxKind> RefGlobalMemberScriptModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 64SyntaxKind.ExternKeyword, 65SyntaxKind.InternalKeyword, 66SyntaxKind.NewKeyword, 67SyntaxKind.OverrideKeyword, 68SyntaxKind.PublicKeyword, 69SyntaxKind.PrivateKeyword, 71SyntaxKind.StaticKeyword, 72SyntaxKind.UnsafeKeyword, 110if (context.TargetToken.IsKind(SyntaxKind.ColonToken)) 115else if (context.TargetToken.Kind() == SyntaxKind.OpenParenToken) 119else if (context.TargetToken.Kind() == SyntaxKind.CommaToken) 147if (token.Kind() == SyntaxKind.IdentifierToken && SyntaxFacts.GetContextualKeywordKind((string)token.Value!) == SyntaxKind.AllowsKeyword && 154.Any(c => c.ClassOrStructKeyword.Kind() == SyntaxKind.ClassKeyword)) 166position, context.LeftToken, includeOperators: false, out var parameterIndex, out var previousModifier)) 168if (previousModifier is SyntaxKind.None or SyntaxKind.ScopedKeyword) 173if (previousModifier == SyntaxKind.ThisKeyword && 222case SyntaxKind.ReturnKeyword: 226case SyntaxKind.ScopedKeyword: 227case SyntaxKind.IdentifierToken when token.Text == "scoped": 233case SyntaxKind.EqualsGreaterThanToken: 241case SyntaxKind.OpenParenToken: 243return previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword; 248case SyntaxKind.EqualsToken: 250return parent?.Kind() == SyntaxKind.SimpleAssignmentExpression 251|| parent?.Parent?.Kind() == SyntaxKind.VariableDeclarator; 256case SyntaxKind.QuestionToken: 257case SyntaxKind.ColonToken: 258return token.Parent?.Kind() == SyntaxKind.ConditionalExpression;
Completion\KeywordRecommenders\RegionKeywordRecommender.cs (1)
10internal sealed class RegionKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RegionKeyword, isValidInPreprocessorContext: true, shouldFormatOnCommit: true)
Completion\KeywordRecommenders\RemoveKeywordRecommender.cs (2)
11internal sealed class RemoveKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RemoveKeyword) 14=> context.TargetToken.IsAccessorDeclarationContext<EventDeclarationSyntax>(position, SyntaxKind.RemoveKeyword);
Completion\KeywordRecommenders\RequiredKeywordRecommender.cs (7)
14internal sealed class RequiredKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RequiredKeyword) 16private static readonly ISet<SyntaxKind> s_validModifiers = SyntaxKindSet.AllMemberModifiers.Where(s => s is not (SyntaxKind.RequiredKeyword or SyntaxKind.StaticKeyword or SyntaxKind.ReadOnlyKeyword or SyntaxKind.ConstKeyword)).ToSet(); 18private static readonly ISet<SyntaxKind> s_validTypeDeclarations = SyntaxKindSet.ClassStructRecordTypeDeclarations;
Completion\KeywordRecommenders\RestoreKeywordRecommender.cs (6)
10internal sealed class RestoreKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.RestoreKeyword, isValidInPreprocessorContext: true) 21(previousToken1.Kind() == SyntaxKind.WarningKeyword && 22previousToken2.Kind() == SyntaxKind.PragmaKeyword && 23previousToken3.Kind() == SyntaxKind.HashToken) || 26(previousToken1.Kind() == SyntaxKind.NullableKeyword && 27previousToken2.Kind() == SyntaxKind.HashToken);
Completion\KeywordRecommenders\ReturnKeywordRecommender.cs (2)
13internal sealed class ReturnKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ReturnKeyword) 35return token.Kind() == SyntaxKind.OpenBracketToken &&
Completion\KeywordRecommenders\SByteKeywordRecommender.cs (3)
14internal sealed class SByteKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.SByteKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\ScopedKeywordRecommender.cs (5)
11internal sealed class ScopedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ScopedKeyword) 36case SyntaxKind.OpenParenToken: 38return previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword; 41case SyntaxKind.OutKeyword:
Completion\KeywordRecommenders\SealedKeywordRecommender.cs (29)
12internal sealed class SealedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.SealedKeyword) 14private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.ExternKeyword, 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.OverrideKeyword, 20SyntaxKind.PublicKeyword, 21SyntaxKind.ProtectedKeyword, 22SyntaxKind.UnsafeKeyword, 25private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 27SyntaxKind.ExternKeyword, 28SyntaxKind.InternalKeyword, 29SyntaxKind.NewKeyword, 30SyntaxKind.OverrideKeyword, 31SyntaxKind.PublicKeyword, 32SyntaxKind.ProtectedKeyword, 33SyntaxKind.StaticKeyword, 34SyntaxKind.UnsafeKeyword, 37private static readonly ISet<SyntaxKind> s_validTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 39SyntaxKind.InternalKeyword, 40SyntaxKind.NewKeyword, 41SyntaxKind.PublicKeyword, 42SyntaxKind.PrivateKeyword, 43SyntaxKind.ProtectedKeyword, 44SyntaxKind.UnsafeKeyword, 45SyntaxKind.FileKeyword,
Completion\KeywordRecommenders\SelectKeywordRecommender.cs (1)
11internal sealed class SelectKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.SelectKeyword)
Completion\KeywordRecommenders\SetKeywordRecommender.cs (3)
11internal sealed class SetKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.SetKeyword) 16context.TargetToken.IsAccessorDeclarationContext<PropertyDeclarationSyntax>(position, SyntaxKind.SetKeyword) || 17context.TargetToken.IsAccessorDeclarationContext<IndexerDeclarationSyntax>(position, SyntaxKind.SetKeyword);
Completion\KeywordRecommenders\ShortKeywordRecommender.cs (3)
14internal sealed class ShortKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.ShortKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\SizeOfKeywordRecommender.cs (1)
10internal sealed class SizeOfKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.SizeOfKeyword)
Completion\KeywordRecommenders\StackAllocKeywordRecommender.cs (1)
10internal sealed class StackAllocKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.StackAllocKeyword)
Completion\KeywordRecommenders\StaticKeywordRecommender.cs (55)
13internal sealed class StaticKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.StaticKeyword) 15private static readonly ISet<SyntaxKind> s_validTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.PublicKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.ProtectedKeyword, 22SyntaxKind.UnsafeKeyword, 23SyntaxKind.FileKeyword, 26private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 28SyntaxKind.AsyncKeyword, 29SyntaxKind.ExternKeyword, 30SyntaxKind.InternalKeyword, 31SyntaxKind.NewKeyword, 32SyntaxKind.PublicKeyword, 33SyntaxKind.PrivateKeyword, 34SyntaxKind.ProtectedKeyword, 35SyntaxKind.ReadOnlyKeyword, 36SyntaxKind.UnsafeKeyword, 37SyntaxKind.VolatileKeyword, 40private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 42SyntaxKind.AbstractKeyword, 43SyntaxKind.AsyncKeyword, 44SyntaxKind.ExternKeyword, 45SyntaxKind.InternalKeyword, 46SyntaxKind.NewKeyword, 47SyntaxKind.PublicKeyword, 48SyntaxKind.PrivateKeyword, 49SyntaxKind.ProtectedKeyword, 50SyntaxKind.ReadOnlyKeyword, 51SyntaxKind.SealedKeyword, 52SyntaxKind.UnsafeKeyword, 53SyntaxKind.VolatileKeyword, 54SyntaxKind.VirtualKeyword, 57private static readonly ISet<SyntaxKind> s_validGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 59SyntaxKind.ExternKeyword, 60SyntaxKind.InternalKeyword, 61SyntaxKind.NewKeyword, 62SyntaxKind.PublicKeyword, 63SyntaxKind.PrivateKeyword, 64SyntaxKind.ReadOnlyKeyword, 65SyntaxKind.UnsafeKeyword, 66SyntaxKind.VolatileKeyword, 69private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 71SyntaxKind.ExternKeyword, 72SyntaxKind.AsyncKeyword, 73SyntaxKind.UnsafeKeyword 81(context.TargetToken.IsKind(SyntaxKind.UsingKeyword) && context.TargetToken.Parent?.IsParentKind(SyntaxKind.GlobalStatement) == true) || 84context.SyntaxTree.IsLambdaDeclarationContext(position, otherModifier: SyntaxKind.AsyncKeyword, cancellationToken) ||
Completion\KeywordRecommenders\StringKeywordRecommender.cs (2)
14internal sealed class StringKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.StringKeyword) 39syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) ||
Completion\KeywordRecommenders\StructKeywordRecommender.cs (12)
13internal sealed class StructKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.StructKeyword) 15private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.InternalKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.PrivateKeyword, 20SyntaxKind.ProtectedKeyword, 21SyntaxKind.UnsafeKeyword, 22SyntaxKind.RefKeyword, 23SyntaxKind.ReadOnlyKeyword, 24SyntaxKind.FileKeyword, 57if (token.Kind() == SyntaxKind.RefKeyword &&
Completion\KeywordRecommenders\SwitchKeywordRecommender.cs (1)
10internal sealed class SwitchKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.SwitchKeyword)
Completion\KeywordRecommenders\ThisKeywordRecommender.cs (8)
13internal sealed class ThisKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ThisKeyword) 31token.Kind() == SyntaxKind.ColonToken && 33!constructor.Modifiers.Any(SyntaxKind.StaticKeyword); 39context.Position, context.LeftToken, includeOperators: false, out var parameterIndex, out var previousModifier)) 42is SyntaxKind.None 43or SyntaxKind.RefKeyword 44or SyntaxKind.InKeyword 45or SyntaxKind.ReadOnlyKeyword)
Completion\KeywordRecommenders\ThrowKeywordRecommender.cs (6)
10internal sealed class ThrowKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.ThrowKeyword) 20if (context.TargetToken.IsKind(SyntaxKind.EqualsGreaterThanToken)) 26if (context.TargetToken.IsKind(SyntaxKind.QuestionQuestionToken)) 33if (context.TargetToken.Kind() is SyntaxKind.QuestionToken or 34SyntaxKind.ColonToken) 36return context.TargetToken.Parent.IsKind(SyntaxKind.ConditionalExpression);
Completion\KeywordRecommenders\TrueKeywordRecommender.cs (1)
10internal sealed class TrueKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.TrueKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\TryKeywordRecommender.cs (1)
10internal sealed class TryKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.TryKeyword)
Completion\KeywordRecommenders\TypeKeywordRecommender.cs (1)
10internal sealed class TypeKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.TypeKeyword)
Completion\KeywordRecommenders\TypeOfKeywordRecommender.cs (1)
12internal sealed class TypeOfKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.TypeOfKeyword)
Completion\KeywordRecommenders\TypeVarKeywordRecommender.cs (3)
12internal sealed class TypeVarKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.TypeVarKeyword) 18if (token.Kind() == SyntaxKind.OpenBracketToken && 19token.Parent.IsKind(SyntaxKind.AttributeList))
Completion\KeywordRecommenders\UIntKeywordRecommender.cs (3)
14internal sealed class UIntKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.UIntKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\ULongKeywordRecommender.cs (3)
14internal sealed class ULongKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.ULongKeyword) 38syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 39syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\UncheckedKeywordRecommender.cs (1)
10internal sealed class UncheckedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UncheckedKeyword)
Completion\KeywordRecommenders\UndefKeywordRecommender.cs (1)
11internal sealed class UndefKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UndefKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\UnionKeywordRecommender.cs (10)
12internal sealed class UnionKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UnionKeyword) 14private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.InternalKeyword, 17SyntaxKind.PublicKeyword, 18SyntaxKind.PrivateKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.UnsafeKeyword, 21SyntaxKind.ReadOnlyKeyword, 22SyntaxKind.FileKeyword,
Completion\KeywordRecommenders\UnmanagedKeywordRecommender.cs (1)
10internal sealed class UnmanagedKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UnmanagedKeyword)
Completion\KeywordRecommenders\UnsafeKeywordRecommender.cs (45)
12internal sealed class UnsafeKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UnsafeKeyword) 14private static readonly ISet<SyntaxKind> s_validTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.AbstractKeyword, 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.PublicKeyword, 20SyntaxKind.PrivateKeyword, 21SyntaxKind.ProtectedKeyword, 22SyntaxKind.ClosedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.FileKeyword, 28private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 30SyntaxKind.AbstractKeyword, 31SyntaxKind.ExternKeyword, 32SyntaxKind.InternalKeyword, 33SyntaxKind.NewKeyword, 34SyntaxKind.OverrideKeyword, 35SyntaxKind.PublicKeyword, 36SyntaxKind.PrivateKeyword, 37SyntaxKind.ProtectedKeyword, 38SyntaxKind.ReadOnlyKeyword, 39SyntaxKind.SealedKeyword, 40SyntaxKind.StaticKeyword, 41SyntaxKind.VirtualKeyword, 42SyntaxKind.VolatileKeyword, 45private static readonly ISet<SyntaxKind> s_validGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 47SyntaxKind.ExternKeyword, 48SyntaxKind.InternalKeyword, 49SyntaxKind.NewKeyword, 50SyntaxKind.PublicKeyword, 51SyntaxKind.PrivateKeyword, 52SyntaxKind.ReadOnlyKeyword, 53SyntaxKind.StaticKeyword, 54SyntaxKind.VolatileKeyword, 57private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 59SyntaxKind.ExternKeyword, 60SyntaxKind.StaticKeyword, 61SyntaxKind.AsyncKeyword 78(context.IsInImportsDirective && context.TargetToken.Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword);
Completion\KeywordRecommenders\UShortKeywordRecommender.cs (3)
15internal sealed class UShortKeywordRecommender() : AbstractSpecialTypePreselectingKeywordRecommender(SyntaxKind.UShortKeyword) 45syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 46syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) ||
Completion\KeywordRecommenders\UsingKeywordRecommender.cs (21)
12internal sealed class UsingKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.UsingKeyword) 91if (token.Kind() == SyntaxKind.None) 98if ((token.Kind() == SyntaxKind.OpenBraceToken && token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 99|| (token.Kind() == SyntaxKind.SemicolonToken && token.Parent.IsKind(SyntaxKind.FileScopedNamespaceDeclaration))) 103if (nextToken.Kind() == SyntaxKind.ExternKeyword) 116if (token.Kind() == SyntaxKind.SemicolonToken) 118if (token.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective)) 134if (previousToken.Kind() == SyntaxKind.None) 137if (token.Kind() == SyntaxKind.GlobalKeyword) 141else if (token.Kind() == SyntaxKind.IdentifierToken && SyntaxFacts.GetContextualKeywordKind((string)token.Value!) == SyntaxKind.GlobalKeyword) 146else if (previousToken.Kind() == SyntaxKind.SemicolonToken && 147previousToken.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective)) 149if (token.Kind() == SyntaxKind.GlobalKeyword) 153else if (token.Kind() == SyntaxKind.IdentifierToken && SyntaxFacts.GetContextualKeywordKind((string)token.Value!) == SyntaxKind.GlobalKeyword) 166if (nextToken.Kind() == SyntaxKind.ExternKeyword ||
Completion\KeywordRecommenders\VirtualKeywordRecommender.cs (22)
12internal sealed class VirtualKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.VirtualKeyword) 14private static readonly ISet<SyntaxKind> s_validNonInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 16SyntaxKind.ExternKeyword, 17SyntaxKind.InternalKeyword, 18SyntaxKind.NewKeyword, 19SyntaxKind.PublicKeyword, 20SyntaxKind.ProtectedKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.UnsafeKeyword, 25private static readonly ISet<SyntaxKind> s_validInterfaceMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 27SyntaxKind.ExternKeyword, 28SyntaxKind.InternalKeyword, 29SyntaxKind.NewKeyword, 30SyntaxKind.PublicKeyword, 31SyntaxKind.ProtectedKeyword, 32SyntaxKind.PrivateKeyword, 33SyntaxKind.StaticKeyword, 34SyntaxKind.UnsafeKeyword, 54return !modifiers.Contains(SyntaxKind.PrivateKeyword) || modifiers.Contains(SyntaxKind.ProtectedKeyword);
Completion\KeywordRecommenders\VoidKeywordRecommender.cs (21)
13internal sealed class VoidKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.VoidKeyword) 15private static readonly ISet<SyntaxKind> s_validClassInterfaceRecordModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.NewKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.InternalKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.StaticKeyword, 23SyntaxKind.VirtualKeyword, 24SyntaxKind.SealedKeyword, 25SyntaxKind.OverrideKeyword, 26SyntaxKind.AbstractKeyword, 27SyntaxKind.ExternKeyword, 28SyntaxKind.UnsafeKeyword, 29SyntaxKind.AsyncKeyword 32private static readonly ISet<SyntaxKind> s_validStructModifiers = new HashSet<SyntaxKind>(s_validClassInterfaceRecordModifiers, SyntaxFacts.EqualityComparer) 34SyntaxKind.ReadOnlyKeyword, 75if (token.Kind() == SyntaxKind.OpenParenToken && 76token.Parent.IsKind(SyntaxKind.ParenthesizedExpression))
Completion\KeywordRecommenders\VolatileKeywordRecommender.cs (9)
13internal sealed class VolatileKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.VolatileKeyword) 15private static readonly ISet<SyntaxKind> s_validMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 17SyntaxKind.NewKeyword, 18SyntaxKind.PublicKeyword, 19SyntaxKind.ProtectedKeyword, 20SyntaxKind.InternalKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.StaticKeyword,
Completion\KeywordRecommenders\WarningKeywordRecommender.cs (3)
10internal sealed class WarningKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WarningKeyword, isValidInPreprocessorContext: true) 26previousToken1.Kind() == SyntaxKind.PragmaKeyword && 27previousToken2.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\WarningsKeywordRecommender.cs (6)
10internal sealed class WarningsKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WarningsKeyword, isValidInPreprocessorContext: true) 21(previousToken1.Kind() == SyntaxKind.EnableKeyword || previousToken1.Kind() == SyntaxKind.DisableKeyword || previousToken1.Kind() == SyntaxKind.RestoreKeyword) && 22previousToken2.Kind() == SyntaxKind.NullableKeyword && 23previousToken3.Kind() == SyntaxKind.HashToken;
Completion\KeywordRecommenders\WhenKeywordRecommender.cs (1)
13internal sealed class WhenKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WhenKeyword, isValidInPreprocessorContext: true)
Completion\KeywordRecommenders\WhereKeywordRecommender.cs (6)
14internal sealed class WhereKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WhereKeyword) 40if (token.Kind() == SyntaxKind.GreaterThanToken) 61if (token.Kind() == SyntaxKind.CloseParenToken && 80if (token.Parent is IdentifierNameSyntax && token.HasMatchingText(SyntaxKind.WhereKeyword)) 86.IsKindOrHasMatchingText(SyntaxKind.WhereKeyword); 91if (token.IsKind(SyntaxKind.DotToken))
Completion\KeywordRecommenders\WhileKeywordRecommender.cs (4)
11internal sealed class WhileKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WhileKeyword) 35if (token.Kind() == SyntaxKind.CloseBraceToken && 36token.Parent.IsKind(SyntaxKind.Block) && 37token.Parent.IsParentKind(SyntaxKind.DoStatement))
Completion\KeywordRecommenders\WithKeywordRecommender.cs (2)
11internal sealed class WithKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.WithKeyword) 22if (targetToken.Kind() == SyntaxKind.OpenBracketToken &&
Completion\KeywordRecommenders\YieldKeywordRecommender.cs (1)
10internal sealed class YieldKeywordRecommender() : AbstractSyntacticSingleKeywordRecommender(SyntaxKind.YieldKeyword)
Completion\Providers\ContextVariableArgumentProvider.cs (1)
26protected override string ThisOrMeKeyword => SyntaxFacts.GetText(SyntaxKind.ThisKeyword);
Completion\Providers\OutVariableArgumentProvider.cs (3)
44if (SyntaxFacts.GetKeywordKind(name) != SyntaxKind.None 45|| SyntaxFacts.GetContextualKeywordKind(name) != SyntaxKind.None) 57contextualKind: SyntaxKind.None,
ConvertAnonymousType\CSharpConvertAnonymousTypeToTupleCodeRefactoringProvider.cs (2)
49if (i == n - 1 && i < originalSeparators.Length && originalSeparators[i].TrailingTrivia is [.., (kind: SyntaxKind.EndOfLineTrivia) newLine]) 71nameEquals.Name.GetTrailingTrivia() is [(kind: SyntaxKind.WhitespaceTrivia)]
ConvertAutoPropertyToFullProperty\CSharpConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (5)
76SyntaxKind.SimpleAssignmentExpression, 122=> (accessorListSyntax.Accessors.FirstOrDefault(a => a.IsKind(SyntaxKind.GetAccessorDeclaration)), 123accessorListSyntax.Accessors.FirstOrDefault(a => a.Kind() is SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration)); 138AccessorList.Accessors: [AccessorDeclarationSyntax(SyntaxKind.GetAccessorDeclaration)
ConvertBetweenRegularAndVerbatimString\ConvertBetweenRegularAndVerbatimInterpolatedStringCodeRefactoringProvider.cs (5)
42=> literalExpression.StringStartToken.Kind() == SyntaxKind.InterpolatedVerbatimStringStartToken; 46SyntaxKind newStartKind, Action<IVirtualCharService, StringBuilder, SyntaxToken> addStringText) 82SyntaxKind.InterpolatedStringTextToken, 88SyntaxKind.InterpolatedVerbatimStringStartToken, AddVerbatimStringText); 92SyntaxKind.InterpolatedStringStartToken, AddRegularStringText);
ConvertBetweenRegularAndVerbatimString\ConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider.cs (2)
30=> literalExpression.Kind() == SyntaxKind.StringLiteralExpression; 60SyntaxKind.StringLiteralToken,
ConvertCast\CSharpConvertDirectCastToTryCastCodeRefactoringProvider.cs (2)
35protected override int FromKind => (int)SyntaxKind.CastExpression; 71return BinaryExpression(SyntaxKind.AsExpression, newExpression, newAsKeyword, newTypeNode);
ConvertCast\CSharpConvertTryCastToDirectCastCodeRefactoringProvider.cs (2)
37protected override int FromKind => (int)SyntaxKind.AsExpression; 59if (expression.IsKind(SyntaxKind.NullLiteralExpression) && nullableContext.HasFlag(NullableContext.AnnotationsEnabled) && isReferenceType)
ConvertForEachToFor\CSharpConvertForEachToForCodeRefactoringProvider.cs (2)
50return foreachInfo.ForEachStatement.Parent.IsKind(SyntaxKind.Block); 100SyntaxKind.PostIncrementExpression, IdentifierName(indexVariable))],
ConvertForToForEach\CSharpConvertForToForEachCodeRefactoringProvider.cs (4)
52if (forStatement is { Declaration.Variables: [{ Initializer: not null } declarator], Condition.RawKind: (int)SyntaxKind.LessThanExpression, Incrementors.Count: 1 }) 87case SyntaxKind.PostIncrementExpression: 92case SyntaxKind.PreIncrementExpression: 97case SyntaxKind.AddAssignmentExpression:
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Analyzer.cs (1)
32=> !operation.SemanticModel.AnalyzeControlFlow(operation.Syntax).ExitPoints.Any(static n => n.IsKind(SyntaxKind.BreakStatement));
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (8)
22private static readonly Dictionary<BinaryOperatorKind, SyntaxKind> s_operatorMap = new() 24{ BinaryOperatorKind.LessThan, SyntaxKind.LessThanToken }, 25{ BinaryOperatorKind.GreaterThan, SyntaxKind.GreaterThanToken }, 26{ BinaryOperatorKind.LessThanOrEqual, SyntaxKind.LessThanEqualsToken }, 27{ BinaryOperatorKind.GreaterThanOrEqual, SyntaxKind.GreaterThanEqualsToken }, 52pattern = BinaryPattern(SyntaxKind.OrPattern, pattern.Parenthesize(), nextPattern.Parenthesize()); 84.AggregateOrDefault((prev, current) => BinaryExpression(SyntaxKind.LogicalAndExpression, prev, current))); 113AnalyzedPattern.And p => BinaryPattern(SyntaxKind.AndPattern, AsPatternSyntax(p.LeftPattern, feature).Parenthesize(), AsPatternSyntax(p.RightPattern, feature).Parenthesize()),
ConvertLinq\ConvertForEachToLinqQuery\AbstractConverter.cs (7)
71case SyntaxKind.VariableDeclarator: 80case SyntaxKind.ForEachStatement: 83case SyntaxKind.IfStatement: 205SyntaxKind.SimpleMemberAccessExpression, 246case SyntaxKind.ForEachStatement: 268case SyntaxKind.IfStatement: 280SyntaxKind.SimpleMemberAccessExpression,
ConvertLinq\ConvertForEachToLinqQuery\AbstractToMethodConverter.cs (6)
57case SyntaxKind.LocalDeclarationStatement: 74case SyntaxKind.ExpressionStatement: 147case SyntaxKind.LocalDeclarationStatement: 160case SyntaxKind.VariableDeclarator: 163case SyntaxKind.ExpressionStatement: 182SyntaxKind.SimpleMemberAccessExpression,
ConvertLinq\ConvertForEachToLinqQuery\CSharpConvertForEachToLinqQueryProvider.cs (11)
55case SyntaxKind.Block: 94case SyntaxKind.ForEachStatement: 104case SyntaxKind.IfStatement: 123case SyntaxKind.LocalDeclarationStatement: 138case SyntaxKind.EmptyStatement: 214case SyntaxKind.ExpressionStatement: 219case SyntaxKind.PostIncrementExpression: 240case SyntaxKind.InvocationExpression: 276case SyntaxKind.YieldReturnStatement: 295.Where(statement => statement.Kind() != SyntaxKind.LocalFunctionStatement).ToArray(); 313lastNonLocalFunctionStatement.Kind() == SyntaxKind.YieldBreakStatement &&
ConvertLinq\ConvertForEachToLinqQuery\ToCountConverter.cs (1)
44SyntaxKind.AddAssignmentExpression,
ConvertLinq\ConvertForEachToLinqQuery\ToToListConverter.cs (1)
50SyntaxKind.SimpleMemberAccessExpression,
ConvertLinq\CSharpConvertLinqQueryToForEachProvider.cs (34)
70SyntaxKind.SingleLineCommentTrivia or 71SyntaxKind.MultiLineCommentTrivia or 72SyntaxKind.MultiLineDocumentationCommentTrivia) || 95if (!documentUpdateInfo.Source.IsParentKind(SyntaxKind.Block) && 118case SyntaxKind.WhereClause: 120case SyntaxKind.FromClause: 148case SyntaxKind.LetClause: 151case SyntaxKind.JoinClause: 201SyntaxKind.SimpleMemberAccessExpression, 209case SyntaxKind.SelectClause: 228case SyntaxKind.ReturnStatement: 231case SyntaxKind.ForEachStatement: 234case SyntaxKind.SimpleMemberAccessExpression: 318PostfixUnaryExpression(SyntaxKind.PostIncrementExpression, variableIdentifier)), // Generating 'count++' 319LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0)), // count = 0 351SyntaxKind.SimpleMemberAccessExpression, 459case SyntaxKind.EqualsValueClause: 462SyntaxKind.VariableDeclarator or 463SyntaxKind.VariableDeclaration or 464SyntaxKind.LocalDeclarationStatement && 480case SyntaxKind.SimpleAssignmentExpression: 495case SyntaxKind.ReturnStatement: 572=> YieldStatement(SyntaxKind.YieldReturnStatement, expression); 591SyntaxKind.OpenBraceToken, 763var statements = GenerateStatements(expression => YieldStatement(SyntaxKind.YieldReturnStatement, expression), queryExpressionProcessingInfo); 766var yieldBreakStatement = YieldStatement(SyntaxKind.YieldBreakStatement); 839case SyntaxKind.WhereClause: 842case SyntaxKind.LetClause: 849case SyntaxKind.FromClause: 857case SyntaxKind.JoinClause: 930case SyntaxKind.AnonymousMethodExpression: 931case SyntaxKind.ParenthesizedLambdaExpression: 932case SyntaxKind.SimpleLambdaExpression: 934case SyntaxKind.LocalFunctionStatement:
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs (7)
325var firstConstructorIndex = currentTypeDeclaration.Members.IndexOf(m => m is ConstructorDeclarationSyntax c && !c.Modifiers.Any(SyntaxKind.StaticKeyword)); 454=> node.GetLeadingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia) whitespace] ? whitespace.ToString() : ""; 468? MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), fieldName) 470var assignment = AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, left, parameter.Name.ToIdentifierName()); 480var left = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), fieldOrProperty.Name.ToIdentifierName()) 482var assignment = AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, left, initializer.EqualsToken, initializer.Value); 496baseType?.ArgumentList is null ? null : ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, baseType.ArgumentList),
ConvertPrimaryToRegularConstructor\ConvertPrimaryToRegularConstructorCodeRefactoringProvider_DocumentationComments.cs (7)
57t => t.Kind() == SyntaxKind.XmlTextLiteralNewLineToken || string.IsNullOrWhiteSpace(t.Text)))) 85if (lastIndex - 1 >= 0 && tokens[lastIndex - 1].Kind() == SyntaxKind.XmlTextLiteralToken && string.IsNullOrWhiteSpace(tokens[lastIndex - 1].Text)) 88if (lastIndex - 1 >= 0 && tokens[lastIndex - 1].Kind() == SyntaxKind.XmlTextLiteralNewLineToken) 134if (!content[0].GetLeadingTrivia().Any(SyntaxKind.DocumentationCommentExteriorTrivia)) 139var finalTrivia = DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia, [.. content]); 154if (textToken.Kind() == SyntaxKind.XmlTextLiteralNewLineToken) 157if (textToken.Kind() == SyntaxKind.XmlTextLiteralToken && string.IsNullOrWhiteSpace(textToken.Text))
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (5)
66declaration.Modifiers.Any(SyntaxKind.PartialKeyword); 137while (triviaToMove is [.., SyntaxTrivia(SyntaxKind.SingleLineCommentTrivia), SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 158c => c.Kind() is SyntaxKind.SingleLineCommentTrivia && c.ToString().Contains("https://aka.ms/new-console-template")); 165while (commentIndex < leadingTrivia.Count && leadingTrivia[commentIndex].Kind() is SyntaxKind.EndOfLineTrivia)
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (5)
239modifiers: [.. otherMethod.Modifiers.Where(m => m.Kind() is SyntaxKind.AsyncKeyword or SyntaxKind.UnsafeKeyword)], 263if (!statements[0].GetLeadingTrivia().Any(t => t.Kind() is SyntaxKind.EndOfLineTrivia) && 267namespaceDeclaration.GetLeadingTrivia().TakeWhile(t => t.Kind() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia));
ConvertToExtension\ConvertToExtensionCodeRefactoringProvider.cs (3)
75if (!firstParameter.Modifiers.Any(SyntaxKind.ThisKeyword)) 81if (!methodDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword)) 84if (!classDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword))
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (11)
40StringStartToken: (kind: SyntaxKind.InterpolatedStringStartToken or SyntaxKind.InterpolatedVerbatimStringStartToken), 68if (stringExpression.StringStartToken.Kind() is not SyntaxKind.InterpolatedStringStartToken and not SyntaxKind.InterpolatedVerbatimStringStartToken) 165stringExpression.StringStartToken.Kind() == SyntaxKind.InterpolatedVerbatimStringStartToken) 225kind: SyntaxKind.InterpolatedSingleLineRawStringStartToken)) 230kind: SyntaxKind.InterpolatedRawStringEndToken)); 388kind: SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 393kind: SyntaxKind.InterpolatedRawStringEndToken)); 500if (descendant is LiteralExpressionSyntax(kind: SyntaxKind.StringLiteralExpression) || 688public static SyntaxToken UpdateToken(SyntaxToken token, string text, string valueText = "", SyntaxKind? kind = null)
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (4)
31=> stringExpression.Kind() is SyntaxKind.StringLiteralExpression; 46if (token.Kind() != SyntaxKind.StringLiteralToken) 195SyntaxKind.SingleLineRawStringLiteralToken, 243SyntaxKind.MultiLineRawStringLiteralToken,
Copilot\CSharpImplementNotImplementedExceptionFixProvider.cs (1)
147var syntaxTrivia = leadingTrivia.LastOrDefault(static trivia => trivia.IsKind(SyntaxKind.EndOfLineTrivia));
Debugging\BreakpointResolver.cs (2)
73if (token.IsKind(SyntaxKind.SemicolonToken)) 89!parts.Any(p => p.IsKind(SyntaxKind.AliasQualifiedName)))
Debugging\CSharpProximityExpressionsService.cs (2)
58if (token.Kind() == SyntaxKind.CloseBraceToken && token.GetPreviousToken().Kind() != SyntaxKind.None)
Debugging\CSharpProximityExpressionsService.RelevantExpressionsCollector.cs (4)
114case SyntaxKind.TupleExpression: 124case SyntaxKind.DeclarationExpression: 142case SyntaxKind.ParenthesizedVariableDesignation: 149case SyntaxKind.SingleVariableDesignation:
Debugging\CSharpProximityExpressionsService.Worker.cs (37)
57SyntaxKind.SetAccessorDeclaration or 58SyntaxKind.InitAccessorDeclaration or 59SyntaxKind.AddAccessorDeclaration or 60SyntaxKind.RemoveAccessorDeclaration)) 70if (!memberDeclaration.IsKind(SyntaxKind.GlobalStatement) && !memberDeclaration.GetModifiers().Any(SyntaxKind.StaticKeyword)) 82catchClause.Declaration != null && catchClause.Declaration.Identifier.Kind() != SyntaxKind.None) 191case SyntaxKind.ExpressionStatement: 192case SyntaxKind.LocalDeclarationStatement: 195case SyntaxKind.DoStatement: 199case SyntaxKind.ForStatement: 200case SyntaxKind.ForEachStatement: 201case SyntaxKind.ForEachVariableStatement: 202case SyntaxKind.IfStatement: 203case SyntaxKind.CheckedStatement: 204case SyntaxKind.UncheckedStatement: 205case SyntaxKind.WhileStatement: 206case SyntaxKind.LockStatement: 207case SyntaxKind.SwitchStatement: 208case SyntaxKind.TryStatement: 209case SyntaxKind.UsingStatement: 220var statementAncestor = _parentStatement.Ancestors().OfType<StatementSyntax>().FirstOrDefault(node => !node.IsKind(SyntaxKind.Block)); 237case SyntaxKind.Block: 240case SyntaxKind.BreakStatement: 241case SyntaxKind.ContinueStatement: 244case SyntaxKind.CheckedStatement: 245case SyntaxKind.UncheckedStatement: 248case SyntaxKind.DoStatement: 251case SyntaxKind.ForStatement: 254case SyntaxKind.ForEachStatement: 255case SyntaxKind.ForEachVariableStatement: 258case SyntaxKind.IfStatement: 267case SyntaxKind.LockStatement: 270case SyntaxKind.SwitchStatement: 278case SyntaxKind.TryStatement: 294case SyntaxKind.UsingStatement: 297case SyntaxKind.WhileStatement:
Debugging\CSharpProximityExpressionsService_ExpressionTermCollector.cs (43)
64case SyntaxKind.ThisExpression: 65case SyntaxKind.BaseExpression: 72case SyntaxKind.IdentifierName: 77case SyntaxKind.CharacterLiteralExpression: 78case SyntaxKind.FalseLiteralExpression: 79case SyntaxKind.NullLiteralExpression: 80case SyntaxKind.NumericLiteralExpression: 81case SyntaxKind.StringLiteralExpression: 82case SyntaxKind.TrueLiteralExpression: 89case SyntaxKind.CastExpression: 93case SyntaxKind.SimpleMemberAccessExpression: 94case SyntaxKind.PointerMemberAccessExpression: 98case SyntaxKind.ObjectCreationExpression: 102case SyntaxKind.ArrayCreationExpression: 106case SyntaxKind.InvocationExpression: 189memberAccessExpression.Parent?.Kind() is not SyntaxKind.SimpleMemberAccessExpression and not SyntaxKind.PointerMemberAccessExpression) 197!memberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression)) 282if (prefixUnaryExpression.Kind() is SyntaxKind.LogicalNotExpression or SyntaxKind.BitwiseNotExpression or SyntaxKind.UnaryMinusExpression or SyntaxKind.UnaryPlusExpression) 354case SyntaxKind.AddExpression: 355case SyntaxKind.SubtractExpression: 356case SyntaxKind.MultiplyExpression: 357case SyntaxKind.DivideExpression: 358case SyntaxKind.ModuloExpression: 359case SyntaxKind.LeftShiftExpression: 360case SyntaxKind.RightShiftExpression: 361case SyntaxKind.LogicalOrExpression: 362case SyntaxKind.LogicalAndExpression: 363case SyntaxKind.BitwiseOrExpression: 364case SyntaxKind.BitwiseAndExpression: 365case SyntaxKind.ExclusiveOrExpression: 366case SyntaxKind.EqualsExpression: 367case SyntaxKind.NotEqualsExpression: 368case SyntaxKind.LessThanExpression: 369case SyntaxKind.LessThanOrEqualExpression: 370case SyntaxKind.GreaterThanExpression: 371case SyntaxKind.GreaterThanOrEqualExpression: 372case SyntaxKind.IsExpression: 373case SyntaxKind.AsExpression: 374case SyntaxKind.CoalesceExpression:
Debugging\DataTipInfoGetter.cs (1)
32return token.IsKind(SyntaxKind.IdentifierToken)
Debugging\LocationInfoGetter.cs (3)
32if ((memberDeclaration == null) || (memberDeclaration.Kind() == SyntaxKind.GlobalStatement)) 40if (memberDeclaration.Kind() is SyntaxKind.FieldDeclaration or SyntaxKind.EventFieldDeclaration)
DecompiledSource\CSharpDecompiledSourceFormattingRule.cs (2)
29if (previousToken.Kind() != SyntaxKind.CloseBraceToken) 32if (currentToken.Kind() == SyntaxKind.CloseBraceToken)
Diagnostics\Analyzers\CSharpPreferFrameworkTypeDiagnosticAnalyzer.cs (5)
16SyntaxKind, 22protected override ImmutableArray<SyntaxKind> SyntaxKindsOfInterest { get; } = 23[SyntaxKind.PredefinedType, SyntaxKind.IdentifierName]; 29=> node.Keyword.Kind() != SyntaxKind.VoidKeyword;
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (18)
23: SimplifyTypeNamesDiagnosticAnalyzerBase<SyntaxKind, CSharpSimplifierOptions> 25private static readonly ImmutableArray<SyntaxKind> s_kindsOfInterest = 27SyntaxKind.QualifiedName, 28SyntaxKind.AliasQualifiedName, 29SyntaxKind.GenericName, 30SyntaxKind.IdentifierName, 31SyntaxKind.SimpleMemberAccessExpression, 32SyntaxKind.QualifiedCref, 41SyntaxKind.CompilationUnit or 42SyntaxKind.ClassDeclaration or 43SyntaxKind.RecordDeclaration or 44SyntaxKind.StructDeclaration or 45SyntaxKind.RecordStructDeclaration or 46SyntaxKind.InterfaceDeclaration or 47SyntaxKind.DelegateDeclaration or 48SyntaxKind.EnumDeclaration; 90if (node is MemberAccessExpressionSyntax memberAccess && memberAccess.Expression.IsKind(SyntaxKind.ThisExpression)) 129else if (node.Kind() == SyntaxKind.SimpleMemberAccessExpression)
Diagnostics\Analyzers\CSharpUnboundIdentifiersDiagnosticAnalyzer.cs (4)
16internal sealed class CSharpUnboundIdentifiersDiagnosticAnalyzer : UnboundIdentifiersDiagnosticAnalyzerBase<SyntaxKind, SimpleNameSyntax, QualifiedNameSyntax, IncompleteMemberSyntax> 21private static readonly ImmutableArray<SyntaxKind> s_kindsOfInterest = [SyntaxKind.IncompleteMember]; 23protected override ImmutableArray<SyntaxKind> SyntaxKindsOfInterest => s_kindsOfInterest;
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.cs (4)
149if (node.IsKind(SyntaxKind.QualifiedName) && TrySimplify(node)) 166if (node.IsKind(SyntaxKind.AliasQualifiedName) && TrySimplify(node)) 238if (node.IsKind(SyntaxKind.SimpleMemberAccessExpression) && TrySimplify(node)) 260if (node.IsKind(SyntaxKind.QualifiedCref) && TrySimplify(node))
DocumentationComments\CSharpDocumentationCommentSnippetService.cs (40)
41case SyntaxKind.ClassDeclaration: 42case SyntaxKind.RecordDeclaration: 43case SyntaxKind.InterfaceDeclaration: 44case SyntaxKind.StructDeclaration: 45case SyntaxKind.RecordStructDeclaration: 46case SyntaxKind.DelegateDeclaration: 47case SyntaxKind.EnumDeclaration: 48case SyntaxKind.EnumMemberDeclaration: 49case SyntaxKind.FieldDeclaration: 50case SyntaxKind.MethodDeclaration: 51case SyntaxKind.ConstructorDeclaration: 52case SyntaxKind.DestructorDeclaration: 53case SyntaxKind.PropertyDeclaration: 54case SyntaxKind.IndexerDeclaration: 55case SyntaxKind.EventDeclaration: 56case SyntaxKind.EventFieldDeclaration: 57case SyntaxKind.OperatorDeclaration: 58case SyntaxKind.ConversionOperatorDeclaration: 59case SyntaxKind.ExtensionBlockDeclaration: 68=> member.GetFirstToken().LeadingTrivia.Any(t => t is (kind: SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia)); 77if (previousToken.Kind() != SyntaxKind.None) 131SyntaxKind.MethodDeclaration or 132SyntaxKind.IndexerDeclaration or 133SyntaxKind.DelegateDeclaration or 134SyntaxKind.OperatorDeclaration or 135SyntaxKind.ConstructorDeclaration or 136SyntaxKind.DestructorDeclaration) 140!(returnType is PredefinedTypeSyntax predefinedType && predefinedType.Keyword.IsKindOrHasMatchingText(SyntaxKind.VoidKeyword))) 156var throwExpressionsAndStatements = member.DescendantNodes().Where(n => n.Kind() is SyntaxKind.ThrowExpression or SyntaxKind.ThrowStatement); 171if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 260=> token.RawKind == (int)SyntaxKind.XmlTextLiteralNewLineToken; 263=> trivia.RawKind == (int)SyntaxKind.EndOfLineTrivia; 306return lastTextToken.Kind() == SyntaxKind.XmlTextLiteralNewLineToken 308&& firstTextToken.LeadingTrivia is [(kind: SyntaxKind.DocumentationCommentExteriorTrivia) firstTrivia] 321if (token.LeadingTrivia.Any(SyntaxKind.DocumentationCommentExteriorTrivia)) 359return lastTextToken.Kind() == SyntaxKind.XmlTextLiteralNewLineToken 361&& firstTextToken.LeadingTrivia.ElementAt(0).Kind() == SyntaxKind.DocumentationCommentExteriorTrivia 370=> token.TrailingTrivia.Any(t => t.Kind() == SyntaxKind.SkippedTokensTrivia);
DocumentationComments\DocCommentConverter.cs (2)
48if (node.GetLeadingTrivia().Any(SyntaxKind.SingleLineDocumentationCommentTrivia)) 54if (trivia.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia)
EditAndContinue\BreakpointSpans.cs (85)
174case SyntaxKind.MethodDeclaration: 175case SyntaxKind.OperatorDeclaration: 176case SyntaxKind.ConversionOperatorDeclaration: 177case SyntaxKind.DestructorDeclaration: 181case SyntaxKind.ConstructorDeclaration: 184case SyntaxKind.RecordDeclaration: 185case SyntaxKind.RecordStructDeclaration: 186case SyntaxKind.StructDeclaration: 187case SyntaxKind.ClassDeclaration: 202var baseInitializer = (PrimaryConstructorBaseTypeSyntax?)typeDeclaration.BaseList?.Types.FirstOrDefault(t => t.IsKind(SyntaxKind.PrimaryConstructorBaseType)); 263case SyntaxKind.VariableDeclarator: 267case SyntaxKind.VariableDeclaration: 270case SyntaxKind.EventFieldDeclaration: 271case SyntaxKind.FieldDeclaration: 274case SyntaxKind.ElseClause: 277case SyntaxKind.CatchFilterClause: 280case SyntaxKind.CatchClause: 283case SyntaxKind.FinallyClause: 286case SyntaxKind.CaseSwitchLabel: 287case SyntaxKind.DefaultSwitchLabel: 290case SyntaxKind.CasePatternSwitchLabel: 296case SyntaxKind.SwitchExpressionArm: 303case SyntaxKind.SwitchExpression when 312case SyntaxKind.WhenClause: 315case SyntaxKind.GetAccessorDeclaration: 316case SyntaxKind.SetAccessorDeclaration: 317case SyntaxKind.InitAccessorDeclaration: 318case SyntaxKind.AddAccessorDeclaration: 319case SyntaxKind.RemoveAccessorDeclaration: 320case SyntaxKind.UnknownAccessorDeclaration: 335case SyntaxKind.PropertyDeclaration: 359case SyntaxKind.IndexerDeclaration: 373case SyntaxKind.EventDeclaration: 379case SyntaxKind.BaseConstructorInitializer: 380case SyntaxKind.ThisConstructorInitializer: 389case SyntaxKind.FromClause: 393case SyntaxKind.JoinClause: 397case SyntaxKind.LetClause: 401case SyntaxKind.WhereClause: 405case SyntaxKind.OrderByClause: 411case SyntaxKind.SelectClause: 415case SyntaxKind.GroupClause: 419case SyntaxKind.LocalFunctionStatement: 454if (constructorSyntax.Modifiers.Any(SyntaxKind.StaticKeyword)) 587case SyntaxKind.Block: 590case SyntaxKind.LocalDeclarationStatement: 598case SyntaxKind.LabeledStatement: 603case SyntaxKind.WhileStatement: 611case SyntaxKind.DoStatement: 626case SyntaxKind.ForStatement: 662case SyntaxKind.ForEachStatement: 663case SyntaxKind.ForEachVariableStatement: 675if (forEachStatement.Kind() == SyntaxKind.ForEachStatement) 694case SyntaxKind.UsingStatement: 705case SyntaxKind.FixedStatement: 709case SyntaxKind.CheckedStatement: 710case SyntaxKind.UncheckedStatement: 714case SyntaxKind.UnsafeStatement: 718case SyntaxKind.LockStatement: 725case SyntaxKind.IfStatement: 733case SyntaxKind.SwitchStatement: 740case SyntaxKind.TryStatement: 750case SyntaxKind.GotoStatement: 751case SyntaxKind.GotoCaseStatement: 752case SyntaxKind.GotoDefaultStatement: 753case SyntaxKind.BreakStatement: 754case SyntaxKind.ContinueStatement: 755case SyntaxKind.ReturnStatement: 756case SyntaxKind.YieldReturnStatement: 757case SyntaxKind.YieldBreakStatement: 758case SyntaxKind.ThrowStatement: 759case SyntaxKind.ExpressionStatement: 760case SyntaxKind.EmptyStatement: 771=> token2.IsKind(SyntaxKind.None) || token2.IsMissing ? token1 : token2; 777SyntaxKind.LocalDeclarationStatement or SyntaxKind.EventFieldDeclaration or SyntaxKind.FieldDeclaration => null, 794if (modifiersOpt.Any(SyntaxKind.ConstKeyword)) 854if (variableDeclarator.Initializer == null || modifiers.Any(SyntaxKind.ConstKeyword)) 876if (variableDeclarator.Initializer == null || modifiers.Any(SyntaxKind.ConstKeyword)) 972case SyntaxKind.ArrowExpressionClause: 976case SyntaxKind.SwitchExpressionArm: 980case SyntaxKind.ForStatement: 987case SyntaxKind.ForEachStatement: 988case SyntaxKind.ForEachVariableStatement:
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (382)
76case SyntaxKind.ClassDeclaration: 77case SyntaxKind.StructDeclaration: 89case SyntaxKind.RecordDeclaration: 90case SyntaxKind.RecordStructDeclaration: 98case SyntaxKind.MethodDeclaration: 99case SyntaxKind.ConversionOperatorDeclaration: 100case SyntaxKind.OperatorDeclaration: 101case SyntaxKind.SetAccessorDeclaration: 102case SyntaxKind.InitAccessorDeclaration: 103case SyntaxKind.AddAccessorDeclaration: 104case SyntaxKind.RemoveAccessorDeclaration: 105case SyntaxKind.GetAccessorDeclaration: 106case SyntaxKind.ConstructorDeclaration: 107case SyntaxKind.DestructorDeclaration: 111case SyntaxKind.PropertyDeclaration: 117case SyntaxKind.FieldDeclaration: 118case SyntaxKind.EventFieldDeclaration: 124case SyntaxKind.Parameter: 134case SyntaxKind.VariableDeclarator: 136Debug.Assert(current.Parent.IsKind(SyntaxKind.VariableDeclaration)); 140case SyntaxKind.FieldDeclaration: 141case SyntaxKind.EventFieldDeclaration: 149case SyntaxKind.ArrowExpressionClause: 151if (current.Parent is (kind: SyntaxKind.PropertyDeclaration or SyntaxKind.IndexerDeclaration)) 159case SyntaxKind.GlobalStatement: 160Debug.Assert(current.Parent.IsKind(SyntaxKind.CompilationUnit)); 215case SyntaxKind.Block: 219case SyntaxKind.ForEachStatement: 220case SyntaxKind.ForEachVariableStatement: 225case SyntaxKind.DoStatement: 233case SyntaxKind.PropertyDeclaration: 240case SyntaxKind.VariableDeclaration: 257case SyntaxKind.SwitchExpression: 282case SyntaxKind.SwitchExpressionArm: 420(oldBody.Parent.IsKind(SyntaxKind.LocalFunctionStatement) && newBody.Parent.IsKind(SyntaxKind.LocalFunctionStatement))) 444return parent.IsKind(SyntaxKind.ArrowExpressionClause) && parent.Parent.IsKind(SyntaxKind.LocalFunctionStatement) ? parent.Parent : parent; 505if (oldStatement == oldBody && !newBody.IsKind(SyntaxKind.Block)) 529=> node.IsKind(SyntaxKind.GlobalStatement); 561=> (ushort)SyntaxKind.LineDirectiveTrivia; 583case SyntaxKind.ArrowExpressionClause: 589case SyntaxKind.Block: 593case SyntaxKind.ForEachStatement: 597case SyntaxKind.ForEachVariableStatement: 601case SyntaxKind.DoStatement: 610case SyntaxKind.PropertyDeclaration: 627case SyntaxKind.SwitchExpression: 631case SyntaxKind.SwitchExpressionArm: 642case SyntaxKind.ParameterList when node.Parent is TypeDeclarationSyntax typeDeclaration: 650case SyntaxKind.RecordDeclaration: 651case SyntaxKind.RecordStructDeclaration: 664=> (memberBody, memberBody.IsKind(SyntaxKind.Block) ? (int)BlockPart.OpenBrace : DefaultStatementPart); 686case SyntaxKind.Block: 691case SyntaxKind.ForEachStatement: 692case SyntaxKind.ForEachVariableStatement: 734nodeModifiers.Value.Any(SyntaxKind.StaticKeyword) != fieldOrPropertyModifiers.Value.Any(SyntaxKind.StaticKeyword)) 742case SyntaxKind.Block: 746case SyntaxKind.ForEachStatement: 747case SyntaxKind.ForEachVariableStatement: 766case SyntaxKind.Block: 781case SyntaxKind.ConstructorDeclaration: 785case SyntaxKind.ForEachStatement: 786case SyntaxKind.ForEachVariableStatement: 790case SyntaxKind.IfStatement: 794case SyntaxKind.WhileStatement: 798case SyntaxKind.DoStatement: 802case SyntaxKind.SwitchStatement: 805case SyntaxKind.LockStatement: 808case SyntaxKind.UsingStatement: 882case SyntaxKind.ForEachStatement: return AreEquivalentIgnoringLambdaBodies(((ForEachStatementSyntax)oldNode).Type, ((ForEachStatementSyntax)newNode).Type); 883case SyntaxKind.ForEachVariableStatement: return AreEquivalentIgnoringLambdaBodies(((ForEachVariableStatementSyntax)oldNode).Variable, ((ForEachVariableStatementSyntax)newNode).Variable); 907=> node.IsKind(SyntaxKind.InterfaceDeclaration); 910=> node.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration; 925!fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 970return ctorInitializer is null or { ThisOrBaseKeyword: (kind: SyntaxKind.ThisKeyword), ArgumentList.Arguments: [] }; 975return ctorInitializer is null or (kind: SyntaxKind.BaseConstructorInitializer); 983|| ((BaseTypeDeclarationSyntax)syntaxRefs.Single().GetSyntax()).Modifiers.Any(SyntaxKind.PartialKeyword); 1285if (typeNameSpanChanged && (oldNode.IsKind(SyntaxKind.RecordDeclaration) || newNode.IsKind(SyntaxKind.RecordDeclaration))) 1305if (node.IsKind(SyntaxKind.GetAccessorDeclaration)) 1307Debug.Assert(node.Parent.IsKind(SyntaxKind.AccessorList)); 1329if (node.IsKind(SyntaxKind.TypeParameterConstraintClause)) 1336if (node.IsKind(SyntaxKind.GlobalStatement)) 1344if (node is (kind: SyntaxKind.PrimaryConstructorBaseType or SyntaxKind.BaseList)) 1360if (oldNode.IsKind(SyntaxKind.LocalFunctionStatement)) 1382if (node.Kind() is SyntaxKind.UsingDirective or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration) 1387if (node.IsKind(SyntaxKind.TypeParameterConstraintClause)) 1395if (node.IsKind(SyntaxKind.GlobalStatement)) 1405if (node.IsKind(SyntaxKind.BaseList)) 1446=> node.IsKind(SyntaxKind.LocalFunctionStatement) || 1463=> node.IsKind(SyntaxKind.LocalFunctionStatement); 1498case SyntaxKind.FromClause: 1499case SyntaxKind.LetClause: 1500case SyntaxKind.WhereClause: 1501case SyntaxKind.OrderByClause: 1502case SyntaxKind.JoinClause: 1509case SyntaxKind.AscendingOrdering: 1510case SyntaxKind.DescendingOrdering: 1516case SyntaxKind.SelectClause: 1527case SyntaxKind.GroupClause: 1605internal static TextSpan? TryGetDiagnosticSpanImpl(SyntaxKind kind, SyntaxNode node, EditKind editKind) 1609case SyntaxKind.CompilationUnit: 1625case SyntaxKind.GlobalStatement: 1628case SyntaxKind.ExternAliasDirective: 1629case SyntaxKind.UsingDirective: 1632case SyntaxKind.NamespaceDeclaration: 1633case SyntaxKind.FileScopedNamespaceDeclaration: 1637case SyntaxKind.ClassDeclaration: 1638case SyntaxKind.StructDeclaration: 1639case SyntaxKind.InterfaceDeclaration: 1640case SyntaxKind.RecordDeclaration: 1641case SyntaxKind.RecordStructDeclaration: 1646case SyntaxKind.ExtensionBlockDeclaration: 1650case SyntaxKind.BaseList: 1654case SyntaxKind.EnumDeclaration: 1658case SyntaxKind.DelegateDeclaration: 1662case SyntaxKind.FieldDeclaration: 1666case SyntaxKind.EventFieldDeclaration: 1670case SyntaxKind.VariableDeclaration: 1673case SyntaxKind.VariableDeclarator: 1676case SyntaxKind.MethodDeclaration: 1680case SyntaxKind.ConversionOperatorDeclaration: 1684case SyntaxKind.OperatorDeclaration: 1688case SyntaxKind.ConstructorDeclaration: 1692case SyntaxKind.DestructorDeclaration: 1696case SyntaxKind.PropertyDeclaration: 1700case SyntaxKind.IndexerDeclaration: 1704case SyntaxKind.EventDeclaration: 1708case SyntaxKind.EnumMemberDeclaration: 1711case SyntaxKind.GetAccessorDeclaration: 1712case SyntaxKind.SetAccessorDeclaration: 1713case SyntaxKind.InitAccessorDeclaration: 1714case SyntaxKind.AddAccessorDeclaration: 1715case SyntaxKind.RemoveAccessorDeclaration: 1716case SyntaxKind.UnknownAccessorDeclaration: 1720case SyntaxKind.TypeParameterConstraintClause: 1724case SyntaxKind.TypeParameter: 1728case SyntaxKind.AccessorList: 1729case SyntaxKind.TypeParameterList: 1730case SyntaxKind.ParameterList: 1731case SyntaxKind.BracketedParameterList: 1741case SyntaxKind.Parameter: 1747case SyntaxKind.PrimaryConstructorBaseType: 1748case SyntaxKind.AttributeList: 1749case SyntaxKind.Attribute: 1752case SyntaxKind.ArrowExpressionClause: 1758case SyntaxKind.Block: 1761case SyntaxKind.UsingStatement: 1765case SyntaxKind.FixedStatement: 1769case SyntaxKind.LockStatement: 1773case SyntaxKind.StackAllocArrayCreationExpression: 1776case SyntaxKind.ImplicitStackAllocArrayCreationExpression: 1779case SyntaxKind.TryStatement: 1782case SyntaxKind.CatchClause: 1785case SyntaxKind.CatchDeclaration: 1786case SyntaxKind.CatchFilterClause: 1789case SyntaxKind.FinallyClause: 1792case SyntaxKind.IfStatement: 1796case SyntaxKind.ElseClause: 1799case SyntaxKind.SwitchStatement: 1804case SyntaxKind.SwitchSection: 1807case SyntaxKind.WhileStatement: 1811case SyntaxKind.DoStatement: 1814case SyntaxKind.ForStatement: 1818case SyntaxKind.ForEachStatement: 1819case SyntaxKind.ForEachVariableStatement: 1825case SyntaxKind.LabeledStatement: 1828case SyntaxKind.CheckedStatement: 1829case SyntaxKind.UncheckedStatement: 1832case SyntaxKind.UnsafeStatement: 1835case SyntaxKind.LocalFunctionStatement: 1839case SyntaxKind.YieldBreakStatement: 1840case SyntaxKind.YieldReturnStatement: 1841case SyntaxKind.ReturnStatement: 1842case SyntaxKind.ThrowStatement: 1843case SyntaxKind.ExpressionStatement: 1844case SyntaxKind.EmptyStatement: 1845case SyntaxKind.GotoStatement: 1846case SyntaxKind.GotoCaseStatement: 1847case SyntaxKind.GotoDefaultStatement: 1848case SyntaxKind.BreakStatement: 1849case SyntaxKind.ContinueStatement: 1852case SyntaxKind.LocalDeclarationStatement: 1856case SyntaxKind.AwaitExpression: 1859case SyntaxKind.AnonymousObjectCreationExpression: 1862case SyntaxKind.ParenthesizedLambdaExpression: 1866case SyntaxKind.SimpleLambdaExpression: 1869case SyntaxKind.AnonymousMethodExpression: 1872case SyntaxKind.QueryExpression: 1875case SyntaxKind.QueryBody: 1879case SyntaxKind.QueryContinuation: 1882case SyntaxKind.FromClause: 1885case SyntaxKind.JoinClause: 1888case SyntaxKind.JoinIntoClause: 1891case SyntaxKind.LetClause: 1894case SyntaxKind.WhereClause: 1897case SyntaxKind.OrderByClause: 1900case SyntaxKind.AscendingOrdering: 1901case SyntaxKind.DescendingOrdering: 1904case SyntaxKind.SelectClause: 1907case SyntaxKind.GroupClause: 1910case SyntaxKind.IsPatternExpression: 1911case SyntaxKind.TupleType: 1912case SyntaxKind.TupleExpression: 1913case SyntaxKind.DeclarationExpression: 1914case SyntaxKind.RefType: 1915case SyntaxKind.RefExpression: 1916case SyntaxKind.DeclarationPattern: 1917case SyntaxKind.SimpleAssignmentExpression: 1918case SyntaxKind.WhenClause: 1919case SyntaxKind.SingleVariableDesignation: 1920case SyntaxKind.CasePatternSwitchLabel: 1923case SyntaxKind.SwitchExpression: 1926case SyntaxKind.SwitchExpressionArm: 1946case SyntaxKind.ParenthesizedLambdaExpression: 1949case SyntaxKind.SimpleLambdaExpression: 1953case SyntaxKind.AnonymousMethodExpression: 2002case SyntaxKind.CompilationUnit: 2005case SyntaxKind.GlobalStatement: 2008case SyntaxKind.ExternAliasDirective: 2011case SyntaxKind.UsingDirective: 2016case SyntaxKind.NamespaceDeclaration: 2017case SyntaxKind.FileScopedNamespaceDeclaration: 2020case SyntaxKind.ClassDeclaration: 2023case SyntaxKind.StructDeclaration: 2026case SyntaxKind.InterfaceDeclaration: 2029case SyntaxKind.RecordDeclaration: 2032case SyntaxKind.RecordStructDeclaration: 2035case SyntaxKind.EnumDeclaration: 2038case SyntaxKind.DelegateDeclaration: 2041case SyntaxKind.FieldDeclaration: 2043return declaration.Modifiers.Any(SyntaxKind.ConstKeyword) ? FeaturesResources.const_field : FeaturesResources.field; 2045case SyntaxKind.EventFieldDeclaration: 2048case SyntaxKind.VariableDeclaration: 2049case SyntaxKind.VariableDeclarator: 2052case SyntaxKind.MethodDeclaration: 2055case SyntaxKind.ConversionOperatorDeclaration: 2058case SyntaxKind.OperatorDeclaration: 2061case SyntaxKind.ConstructorDeclaration: 2063return ctor.Modifiers.Any(SyntaxKind.StaticKeyword) ? FeaturesResources.static_constructor : FeaturesResources.constructor; 2065case SyntaxKind.DestructorDeclaration: 2068case SyntaxKind.PropertyDeclaration: 2071case SyntaxKind.IndexerDeclaration: 2074case SyntaxKind.EventDeclaration: 2077case SyntaxKind.EnumMemberDeclaration: 2080case SyntaxKind.GetAccessorDeclaration: 2081if (node.Parent!.Parent!.IsKind(SyntaxKind.PropertyDeclaration)) 2087RoslynDebug.Assert(node.Parent.Parent.IsKind(SyntaxKind.IndexerDeclaration)); 2091case SyntaxKind.InitAccessorDeclaration: 2092case SyntaxKind.SetAccessorDeclaration: 2093if (node.Parent!.Parent!.IsKind(SyntaxKind.PropertyDeclaration)) 2099RoslynDebug.Assert(node.Parent.Parent.IsKind(SyntaxKind.IndexerDeclaration)); 2103case SyntaxKind.AddAccessorDeclaration: 2104case SyntaxKind.RemoveAccessorDeclaration: 2107case SyntaxKind.ArrowExpressionClause: 2110SyntaxKind.PropertyDeclaration => CSharpFeaturesResources.property_getter, 2111SyntaxKind.IndexerDeclaration => CSharpFeaturesResources.indexer_getter, 2115case SyntaxKind.TypeParameterConstraintClause: 2118case SyntaxKind.TypeParameterList: 2119case SyntaxKind.TypeParameter: 2122case SyntaxKind.Parameter: 2125case SyntaxKind.ParameterList: 2128case SyntaxKind.AttributeList: 2131case SyntaxKind.Attribute: 2134case SyntaxKind.AttributeTargetSpecifier: 2139case SyntaxKind.TryStatement: 2142case SyntaxKind.CatchClause: 2143case SyntaxKind.CatchDeclaration: 2146case SyntaxKind.CatchFilterClause: 2149case SyntaxKind.FinallyClause: 2152case SyntaxKind.FixedStatement: 2155case SyntaxKind.UsingStatement: 2158case SyntaxKind.LockStatement: 2161case SyntaxKind.ForEachStatement: 2162case SyntaxKind.ForEachVariableStatement: 2165case SyntaxKind.CheckedStatement: 2168case SyntaxKind.UncheckedStatement: 2171case SyntaxKind.YieldBreakStatement: 2174case SyntaxKind.YieldReturnStatement: 2177case SyntaxKind.AwaitExpression: 2180case SyntaxKind.ParenthesizedLambdaExpression: 2181case SyntaxKind.SimpleLambdaExpression: 2184case SyntaxKind.AnonymousMethodExpression: 2187case SyntaxKind.FromClause: 2190case SyntaxKind.JoinClause: 2191case SyntaxKind.JoinIntoClause: 2194case SyntaxKind.LetClause: 2197case SyntaxKind.WhereClause: 2200case SyntaxKind.OrderByClause: 2201case SyntaxKind.AscendingOrdering: 2202case SyntaxKind.DescendingOrdering: 2205case SyntaxKind.SelectClause: 2208case SyntaxKind.GroupClause: 2211case SyntaxKind.QueryBody: 2214case SyntaxKind.QueryContinuation: 2217case SyntaxKind.IsPatternExpression: 2220case SyntaxKind.SimpleAssignmentExpression: 2230case SyntaxKind.TupleType: 2231case SyntaxKind.TupleExpression: 2234case SyntaxKind.LocalFunctionStatement: 2237case SyntaxKind.DeclarationExpression: 2240case SyntaxKind.RefType: 2241case SyntaxKind.RefExpression: 2244case SyntaxKind.SwitchStatement: 2247case SyntaxKind.LocalDeclarationStatement: 2248if (((LocalDeclarationStatementSyntax)node).UsingKeyword.IsKind(SyntaxKind.UsingKeyword)) 2255case SyntaxKind.ExtensionBlockDeclaration: 2267case SyntaxKind.ForEachStatement: 2268Debug.Assert(((CommonForEachStatementSyntax)node).AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)); 2271case SyntaxKind.VariableDeclarator: 2272RoslynDebug.Assert(((LocalDeclarationStatementSyntax)node.Parent!.Parent!).AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)); 2382if (_newNode.IsKind(SyntaxKind.LocalFunctionStatement)) 2389case SyntaxKind.EnumMemberDeclaration: 2395case SyntaxKind.TypeParameter: 2405case SyntaxKind.ExtensionBlockDeclaration: 2410case SyntaxKind.ExternAliasDirective: 2414case SyntaxKind.Attribute: 2415case SyntaxKind.AttributeList: 2421if (node.IsParentKind(SyntaxKind.CompilationUnit) || node.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 2434case SyntaxKind.ExternAliasDirective: 2440case SyntaxKind.ExtensionBlockDeclaration: 2445case SyntaxKind.AttributeList: 2446case SyntaxKind.Attribute: 2452if (oldNode.IsParentKind(SyntaxKind.CompilationUnit) || oldNode.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 2465case SyntaxKind.ExternAliasDirective: 2469case SyntaxKind.Attribute: 2475if (newNode.IsParentKind(SyntaxKind.CompilationUnit) || newNode.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 2507if (node.Kind() is SyntaxKind.StackAllocArrayCreationExpression or SyntaxKind.ImplicitStackAllocArrayCreationExpression) 2593var kind = current.Kind(); 2597case SyntaxKind.TryStatement: 2605case SyntaxKind.CatchClause: 2606case SyntaxKind.FinallyClause: 2611RoslynDebug.Assert(current.Parent.Kind() == SyntaxKind.TryStatement); 2617case SyntaxKind.ClassDeclaration: 2618case SyntaxKind.StructDeclaration: 2619case SyntaxKind.RecordDeclaration: 2620case SyntaxKind.RecordStructDeclaration: 2659case SyntaxKind.TryStatement: 2665case SyntaxKind.CatchClause: 2666case SyntaxKind.FinallyClause: 2693case SyntaxKind.TryStatement: 2709case SyntaxKind.CatchClause: 2713case SyntaxKind.FinallyClause: 2732if (newNode.IsKind(SyntaxKind.AwaitExpression) && oldNode.IsKind(SyntaxKind.AwaitExpression)) 2759case SyntaxKind.ForStatement: 2760case SyntaxKind.ForEachStatement: 2761case SyntaxKind.IfStatement: 2762case SyntaxKind.WhileStatement: 2763case SyntaxKind.DoStatement: 2764case SyntaxKind.SwitchStatement: 2765case SyntaxKind.LockStatement: 2766case SyntaxKind.UsingStatement: 2767case SyntaxKind.ArrowExpressionClause: 2782Debug.Assert(awaitExpression.IsKind(SyntaxKind.AwaitExpression)); 2792case SyntaxKind.ExpressionStatement: 2793case SyntaxKind.ReturnStatement: 2807case SyntaxKind.VariableDeclaration: 2812case SyntaxKind.LocalDeclarationStatement: 2825case SyntaxKind.ExpressionStatement: 2828case SyntaxKind.ReturnStatement: 2839if (node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment) 2841return assignment.Left.IsKind(SyntaxKind.IdentifierName) && assignment.Right == awaitExpression; 2877if (!oldActiveStatement.IsKind(SyntaxKind.WhenClause)) 2892Debug.Assert(newActiveStatement.IsKind(SyntaxKind.WhenClause)); 2974case SyntaxKind.CheckedStatement: 2975case SyntaxKind.UncheckedStatement: 3014nodeSelector: static n => n.IsKind(SyntaxKind.LockStatement), 3029nodeSelector: static n => n.IsKind(SyntaxKind.FixedStatement), 3060nodeSelector: static n => n.Kind() is SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement,
EditAndContinue\SyntaxComparer.cs (269)
237=> (int)Classify((SyntaxKind)kind, node, out isLeaf); 239internal Label Classify(SyntaxKind kind, SyntaxNode? node, out bool isLeaf) 247if (node != null && node.Parent.IsKind(SyntaxKind.ForStatement) && node is ExpressionSyntax) 260case SyntaxKind.CompilationUnit: 263case SyntaxKind.TypeParameterList: 266case SyntaxKind.TypeParameterConstraintClause: 269case SyntaxKind.TypeParameter: 273case SyntaxKind.BracketedParameterList: 276case SyntaxKind.ParameterList: 279case SyntaxKind.Parameter: 282case SyntaxKind.ConstructorDeclaration: 295private static Label ClassifyStatementSyntax(SyntaxKind kind, SyntaxNode? node, out bool isLeaf) 323case SyntaxKind.NamespaceDeclaration: 324case SyntaxKind.ClassDeclaration: 325case SyntaxKind.InterfaceDeclaration: 326case SyntaxKind.StructDeclaration: 327case SyntaxKind.RecordDeclaration: 328case SyntaxKind.RecordStructDeclaration: 334case SyntaxKind.LocalDeclarationStatement: 337case SyntaxKind.SingleVariableDesignation: 340case SyntaxKind.LabeledStatement: 343case SyntaxKind.EmptyStatement: 347case SyntaxKind.GotoStatement: 351case SyntaxKind.GotoCaseStatement: 352case SyntaxKind.GotoDefaultStatement: 356case SyntaxKind.BreakStatement: 357case SyntaxKind.ContinueStatement: 361case SyntaxKind.ReturnStatement: 362case SyntaxKind.ThrowStatement: 365case SyntaxKind.ExpressionStatement: 368case SyntaxKind.YieldBreakStatement: 372case SyntaxKind.YieldReturnStatement: 375case SyntaxKind.DoStatement: 378case SyntaxKind.WhileStatement: 381case SyntaxKind.ForStatement: 384case SyntaxKind.ForEachVariableStatement: 385case SyntaxKind.ForEachStatement: 388case SyntaxKind.UsingStatement: 398case SyntaxKind.FixedStatement: 401case SyntaxKind.CheckedStatement: 402case SyntaxKind.UncheckedStatement: 405case SyntaxKind.UnsafeStatement: 408case SyntaxKind.LockStatement: 411case SyntaxKind.IfStatement: 414case SyntaxKind.ElseClause: 417case SyntaxKind.SwitchStatement: 420case SyntaxKind.SwitchSection: 423case SyntaxKind.CaseSwitchLabel: 424case SyntaxKind.DefaultSwitchLabel: 430case SyntaxKind.WhenClause: 433case SyntaxKind.CasePatternSwitchLabel: 436case SyntaxKind.SwitchExpression: 439case SyntaxKind.SwitchExpressionArm: 442case SyntaxKind.TryStatement: 445case SyntaxKind.CatchClause: 448case SyntaxKind.CatchDeclaration: 452case SyntaxKind.CatchFilterClause: 455case SyntaxKind.FinallyClause: 458case SyntaxKind.FromClause: 469if (node == null || node.Parent.IsKind(SyntaxKind.QueryExpression)) 476case SyntaxKind.QueryBody: 479case SyntaxKind.QueryContinuation: 482case SyntaxKind.LetClause: 485case SyntaxKind.WhereClause: 488case SyntaxKind.OrderByClause: 491case SyntaxKind.AscendingOrdering: 492case SyntaxKind.DescendingOrdering: 495case SyntaxKind.SelectClause: 498case SyntaxKind.JoinClause: 501case SyntaxKind.JoinIntoClause: 504case SyntaxKind.GroupClause: 507case SyntaxKind.IdentifierName: 508case SyntaxKind.QualifiedName: 509case SyntaxKind.GenericName: 510case SyntaxKind.TypeArgumentList: 511case SyntaxKind.AliasQualifiedName: 512case SyntaxKind.PredefinedType: 513case SyntaxKind.PointerType: 514case SyntaxKind.NullableType: 515case SyntaxKind.TupleType: 516case SyntaxKind.RefType: 517case SyntaxKind.OmittedTypeArgument: 518case SyntaxKind.NameColon: 519case SyntaxKind.OmittedArraySizeExpression: 520case SyntaxKind.ThisExpression: 521case SyntaxKind.BaseExpression: 522case SyntaxKind.ArgListExpression: 523case SyntaxKind.NumericLiteralExpression: 524case SyntaxKind.StringLiteralExpression: 525case SyntaxKind.CharacterLiteralExpression: 526case SyntaxKind.TrueLiteralExpression: 527case SyntaxKind.FalseLiteralExpression: 528case SyntaxKind.NullLiteralExpression: 529case SyntaxKind.TypeOfExpression: 530case SyntaxKind.SizeOfExpression: 531case SyntaxKind.DefaultExpression: 532case SyntaxKind.ConstantPattern: 533case SyntaxKind.DiscardDesignation: 538case SyntaxKind.AwaitExpression: 541case SyntaxKind.ParenthesizedLambdaExpression: 542case SyntaxKind.SimpleLambdaExpression: 543case SyntaxKind.AnonymousMethodExpression: 544case SyntaxKind.LocalFunctionStatement: 547case SyntaxKind.VariableDeclaration: 550case SyntaxKind.VariableDeclarator: 553case SyntaxKind.Block: 562private static Label ClassifyTopSyntax(SyntaxKind kind, SyntaxNode? node, out bool isLeaf) 574case SyntaxKind.GlobalStatement: 578case SyntaxKind.ExternAliasDirective: 582case SyntaxKind.UsingDirective: 586case SyntaxKind.NamespaceDeclaration: 587case SyntaxKind.FileScopedNamespaceDeclaration: 590case SyntaxKind.ClassDeclaration: 591case SyntaxKind.StructDeclaration: 592case SyntaxKind.InterfaceDeclaration: 593case SyntaxKind.RecordDeclaration: 594case SyntaxKind.RecordStructDeclaration: 597case SyntaxKind.BaseList: 600case SyntaxKind.PrimaryConstructorBaseType: 605case SyntaxKind.MethodDeclaration: 608case SyntaxKind.EnumDeclaration: 611case SyntaxKind.DelegateDeclaration: 614case SyntaxKind.FieldDeclaration: 615case SyntaxKind.EventFieldDeclaration: 618case SyntaxKind.ConversionOperatorDeclaration: 621case SyntaxKind.OperatorDeclaration: 624case SyntaxKind.DestructorDeclaration: 628case SyntaxKind.PropertyDeclaration: 631case SyntaxKind.IndexerDeclaration: 634case SyntaxKind.ArrowExpressionClause: 635if (node?.Parent is (kind: SyntaxKind.PropertyDeclaration or SyntaxKind.IndexerDeclaration)) 640case SyntaxKind.EventDeclaration: 643case SyntaxKind.EnumMemberDeclaration: 647case SyntaxKind.AccessorList: 650case SyntaxKind.GetAccessorDeclaration: 651case SyntaxKind.SetAccessorDeclaration: 652case SyntaxKind.InitAccessorDeclaration: 653case SyntaxKind.AddAccessorDeclaration: 654case SyntaxKind.RemoveAccessorDeclaration: 660case SyntaxKind.VariableDeclaration: 663case SyntaxKind.VariableDeclarator: 668case SyntaxKind.AttributeList: 670if (node is not null && node.IsParentKind(SyntaxKind.CompilationUnit)) 677case SyntaxKind.Attribute: 679if (node is { Parent: { } parent } && parent.IsParentKind(SyntaxKind.CompilationUnit)) 687case SyntaxKind.ExtensionBlockDeclaration: 698internal bool HasLabel(SyntaxKind kind) 713Func<SyntaxKind, bool>? ignoreChildFunction; 717case SyntaxKind.MethodDeclaration: 718case SyntaxKind.ConversionOperatorDeclaration: 719case SyntaxKind.OperatorDeclaration: 720case SyntaxKind.ConstructorDeclaration: 721case SyntaxKind.DestructorDeclaration: 722case SyntaxKind.GetAccessorDeclaration: 723case SyntaxKind.SetAccessorDeclaration: 724case SyntaxKind.InitAccessorDeclaration: 725case SyntaxKind.AddAccessorDeclaration: 726case SyntaxKind.RemoveAccessorDeclaration: 738ignoreChildFunction = childKind => childKind == SyntaxKind.Block || childKind == SyntaxKind.ArrowExpressionClause || HasLabel(childKind); 741case SyntaxKind.SwitchSection: 744case SyntaxKind.ForStatement: 784case SyntaxKind.VariableDeclarator: 790case SyntaxKind.ForStatement: 796case SyntaxKind.ForEachStatement: 797case SyntaxKind.ForEachVariableStatement: 806case SyntaxKind.UsingStatement: 831case SyntaxKind.UsingDirective: 845if (leftUsing.GlobalKeyword.IsKind(SyntaxKind.None) != rightUsing.GlobalKeyword.IsKind(SyntaxKind.None)) 849if (leftUsing.UnsafeKeyword.IsKind(SyntaxKind.None) != rightUsing.UnsafeKeyword.IsKind(SyntaxKind.None)) 855case SyntaxKind.LockStatement: 861case SyntaxKind.FixedStatement: 867case SyntaxKind.WhileStatement: 873case SyntaxKind.DoStatement: 879case SyntaxKind.IfStatement: 885case SyntaxKind.Block: 890case SyntaxKind.CatchClause: 894case SyntaxKind.ParenthesizedLambdaExpression: 895case SyntaxKind.SimpleLambdaExpression: 896case SyntaxKind.AnonymousMethodExpression: 897case SyntaxKind.LocalFunctionStatement: 901case SyntaxKind.SingleVariableDesignation: 905case SyntaxKind.TypeParameterConstraintClause: 909case SyntaxKind.TypeParameter: 913case SyntaxKind.Parameter: 917case SyntaxKind.AttributeList: 921case SyntaxKind.Attribute: 925case SyntaxKind.ExtensionBlockDeclaration: 952if ((leftAsync.Kind() == SyntaxKind.AsyncKeyword) != (rightAsync.Kind() == SyntaxKind.AsyncKeyword)) 985case SyntaxKind.SimpleLambdaExpression: 996case SyntaxKind.ParenthesizedLambdaExpression: 1007case SyntaxKind.AnonymousMethodExpression: 1026case SyntaxKind.LocalFunctionStatement: 1049leftBlock.Parent.IsKind(SyntaxKind.ConstructorDeclaration) || 1050rightBlock.Parent.IsKind(SyntaxKind.ConstructorDeclaration)) 1064case SyntaxKind.IfStatement: 1065case SyntaxKind.ForEachStatement: 1066case SyntaxKind.ForEachVariableStatement: 1067case SyntaxKind.ForStatement: 1068case SyntaxKind.WhileStatement: 1069case SyntaxKind.DoStatement: 1070case SyntaxKind.FixedStatement: 1071case SyntaxKind.LockStatement: 1072case SyntaxKind.UsingStatement: 1073case SyntaxKind.SwitchSection: 1074case SyntaxKind.ParenthesizedLambdaExpression: 1075case SyntaxKind.SimpleLambdaExpression: 1076case SyntaxKind.AnonymousMethodExpression: 1077case SyntaxKind.LocalFunctionStatement: 1082case SyntaxKind.CatchClause: 1102case SyntaxKind.Block: 1103case SyntaxKind.LabeledStatement: 1104case SyntaxKind.GlobalStatement: 1108case SyntaxKind.UnsafeStatement: 1109case SyntaxKind.CheckedStatement: 1110case SyntaxKind.UncheckedStatement: 1111case SyntaxKind.ElseClause: 1112case SyntaxKind.FinallyClause: 1113case SyntaxKind.TryStatement: 1232if (leftStatement.Kind() == SyntaxKind.Block && rightStatement.Kind() == SyntaxKind.Block) 1313case SyntaxKind.ForEachStatement: 1317case SyntaxKind.ForEachVariableStatement: 1331case SyntaxKind.DeclarationExpression: 1337case SyntaxKind.TupleExpression: 1356case SyntaxKind.SingleVariableDesignation: 1360case SyntaxKind.ParenthesizedVariableDesignation: 1369case SyntaxKind.DiscardDesignation: 1424case SyntaxKind.ExternAliasDirective: 1427case SyntaxKind.UsingDirective: 1430case SyntaxKind.NamespaceDeclaration: 1431case SyntaxKind.FileScopedNamespaceDeclaration: 1434case SyntaxKind.ClassDeclaration: 1435case SyntaxKind.StructDeclaration: 1436case SyntaxKind.InterfaceDeclaration: 1437case SyntaxKind.RecordDeclaration: 1438case SyntaxKind.RecordStructDeclaration: 1441case SyntaxKind.EnumDeclaration: 1444case SyntaxKind.DelegateDeclaration: 1447case SyntaxKind.ExtensionBlockDeclaration: 1450case SyntaxKind.FieldDeclaration: 1451case SyntaxKind.EventFieldDeclaration: 1452case SyntaxKind.VariableDeclaration: 1455case SyntaxKind.VariableDeclarator: 1458case SyntaxKind.MethodDeclaration: 1461case SyntaxKind.ConversionOperatorDeclaration: 1464case SyntaxKind.OperatorDeclaration: 1467case SyntaxKind.ConstructorDeclaration: 1470case SyntaxKind.DestructorDeclaration: 1473case SyntaxKind.PropertyDeclaration: 1476case SyntaxKind.IndexerDeclaration: 1479case SyntaxKind.ArrowExpressionClause: 1482case SyntaxKind.EventDeclaration: 1485case SyntaxKind.EnumMemberDeclaration: 1488case SyntaxKind.GetAccessorDeclaration: 1489case SyntaxKind.SetAccessorDeclaration: 1490case SyntaxKind.InitAccessorDeclaration: 1493case SyntaxKind.TypeParameterConstraintClause: 1496case SyntaxKind.TypeParameter: 1499case SyntaxKind.TypeParameterList: 1500case SyntaxKind.ParameterList: 1501case SyntaxKind.BracketedParameterList: 1504case SyntaxKind.Parameter: 1507case SyntaxKind.AttributeList: 1510case SyntaxKind.Attribute:
EditAndContinue\SyntaxUtilities.cs (11)
39ArrowExpressionClauseSyntax { Parent: (kind: SyntaxKind.PropertyDeclaration) or (kind: SyntaxKind.IndexerDeclaration) } arrowExpression 46=> constructorDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword) 56when !fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword) 161var firstGetter = accessorList?.Accessors.Where(a => a.IsKind(SyntaxKind.GetAccessorDeclaration)).FirstOrDefault(); 193if (property.Modifiers.Any(SyntaxKind.AbstractKeyword) || 194property.Modifiers.Any(SyntaxKind.ExternKeyword)) 211return anonymousFunction.AsyncKeyword.IsKind(SyntaxKind.AsyncKeyword); 215if (declaration.IsKind(SyntaxKind.ArrowExpressionClause)) 223MethodDeclarationSyntax method => method.Modifiers.Any(SyntaxKind.AsyncKeyword), 224LocalFunctionStatementSyntax localFunction => localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword),
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (4)
35if (token.Kind() is not (SyntaxKind.StringLiteralToken or SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken)) 64if (token.Kind() is SyntaxKind.MultiLineRawStringLiteralToken)
EmbeddedLanguages\EmbeddedLanguageUtilities.cs (2)
32return token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.Utf8StringLiteralToken && !token.IsVerbatimStringLiteral()
EncapsulateField\CSharpEncapsulateFieldService.cs (6)
53contextualKind: SyntaxKind.IdentifierName, 71var modifierKinds = new[] { SyntaxKind.PrivateKeyword, SyntaxKind.ProtectedKeyword, SyntaxKind.InternalKeyword, SyntaxKind.PublicKeyword }; 191=> field.DeclaringSyntaxReferences.Any(static d => d.GetSyntax().GetAncestor<FieldDeclarationSyntax>().Modifiers.Any(SyntaxKind.NewKeyword));
ExtractMethod\CSharpMethodExtractor.cs (4)
127Contract.ThrowIfTrue(memberNode.Kind() == SyntaxKind.NamespaceDeclaration); 186if (!leadingTrivia.Any(t => t.IsKind(SyntaxKind.EndOfLineTrivia) || t.GetStructure() is EndIfDirectiveTriviaSyntax) && 187!methodDefinition.FindTokenOnLeftOfPosition(methodDefinition.SpanStart).IsKind(SyntaxKind.OpenBraceToken)) 193if (!originalMethodDefinition.FindTokenOnLeftOfPosition(originalMethodDefinition.SpanStart).TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia))
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (1)
100return SyntaxFactory.EmptyStatement(SyntaxFactory.Token([.. triviaList], SyntaxKind.SemicolonToken, [SyntaxFactory.ElasticMarker]));
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (32)
187PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, IdentifierName(FlowControlName)), 264BinaryExpression(SyntaxKind.EqualsExpression, IdentifierName(FlowControlName), LiteralExpression(value)), 345.Any(m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword))) 389if (!typeDecl.IsKind(SyntaxKind.InterfaceDeclaration)) 396return !memberDecl.Modifiers.Any(SyntaxKind.StaticKeyword); 399private static SyntaxKind GetParameterRefSyntaxKind(ParameterBehavior parameterBehavior) 402? SyntaxKind.RefKeyword 404SyntaxKind.OutKeyword : SyntaxKind.None; 514? LiteralExpression(SyntaxKind.NullLiteralExpression) 515: LiteralExpression(SyntaxKind.DefaultLiteralExpression); 522protected SyntaxKind UnderCheckedExpressionContext() 525protected SyntaxKind UnderCheckedStatementContext() 528protected SyntaxKind UnderCheckedContext<T>() where T : SyntaxNode 534return SyntaxKind.None; 542var kind = UnderCheckedStatementContext(); 543if (kind == SyntaxKind.None) 626SyntaxKind.SimpleAssignmentExpression, IdentifierName(identifier), variableDeclaration.Initializer.Value))); 661result.Add(EmptyStatement(Token([.. triviaList], SyntaxKind.SemicolonToken, [ElasticMarker]))); 700.Where(n => n.Kind() is SyntaxKind.DeclarationExpression or SyntaxKind.DeclarationPattern); 706case SyntaxKind.DeclarationExpression: 709if (declaration.Designation.Kind() != SyntaxKind.SingleVariableDesignation) 730case SyntaxKind.DeclarationPattern: 819return statements[index + 1].Kind() == SyntaxKind.ReturnStatement; 827? MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), methodName) 838var modifier = GetParameterRefSyntaxKind(argument.ParameterModifier); 839var refOrOut = modifier == SyntaxKind.None ? default : Token(modifier); 855SyntaxKind.SimpleMemberAccessExpression, 858ArgumentList([Argument(LiteralExpression(SyntaxKind.FalseLiteralExpression))])); 877SyntaxKind.SimpleAssignmentExpression, 924return ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, CreateLeftExpression(), initialValue));
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.cs (8)
46expression.Parent.Kind() == SyntaxKind.EqualsValueClause && 48expression.Parent.Parent.Kind() == SyntaxKind.VariableDeclarator) 65case SyntaxKind.IdentifierName: 66case SyntaxKind.GenericName: 69case SyntaxKind.QualifiedName: 72case SyntaxKind.AliasQualifiedName: 106var kind = UnderCheckedExpressionContext(); 107if (kind == SyntaxKind.None)
ExtractMethod\CSharpMethodExtractor.FormattingProvider.cs (4)
41if (previousToken.RawKind == (int)SyntaxKind.OpenBraceToken) 62if (node.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression or SyntaxKind.AnonymousMethodExpression)
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (3)
216if (trivia.Kind() is not SyntaxKind.WhitespaceTrivia and 217not SyntaxKind.EndOfLineTrivia) 277assignment.Expression.Kind() != SyntaxKind.SimpleAssignmentExpression)
ExtractMethod\CSharpMethodExtractor.TriviaResult.cs (7)
21: TriviaResult(document, result, (int)SyntaxKind.EndOfLineTrivia, (int)SyntaxKind.WhitespaceTrivia) 135if (tokenPair.PreviousToken.RawKind == (int)SyntaxKind.OpenBraceToken) 145if (tokenPair.PreviousToken.RawKind is ((int)SyntaxKind.OpenBraceToken) or 146((int)SyntaxKind.SemicolonToken)) 156if (tokenPair.PreviousToken.RawKind is ((int)SyntaxKind.OpenBraceToken) or 157((int)SyntaxKind.SemicolonToken))
ExtractMethod\CSharpSelectionResult.cs (2)
128Contract.ThrowIfFalse(last.IsParentKind(SyntaxKind.GlobalStatement)); 129Contract.ThrowIfFalse(last.Parent.IsParentKind(SyntaxKind.CompilationUnit));
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (1)
109if ((!node.IsKind(SyntaxKind.ObjectCreationExpression) && semanticModel.GetMemberGroup(expression, cancellationToken).Length > 0) ||
ExtractMethod\CSharpSelectionResult.StatementResult.cs (2)
31MethodDeclarationSyntax method => method.Modifiers.Any(SyntaxKind.AsyncKeyword), 32LocalFunctionStatementSyntax localFunction => localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword),
ExtractMethod\CSharpSelectionValidator.cs (7)
36if (firstTokenInSelection.Kind() == SyntaxKind.None || lastTokenInSelection.Kind() == SyntaxKind.None) 120if (ancestor.Kind() is SyntaxKind.BaseConstructorInitializer or SyntaxKind.ThisConstructorInitializer) 136if (assign.Right.GetLastToken().Kind() == SyntaxKind.None) 303if (tokens.Any(t => t.Kind() == SyntaxKind.YieldKeyword)) 339if (commonNode.Kind() == SyntaxKind.IsPatternExpression)
ExtractMethod\CSharpSyntaxTriviaService.cs (1)
14: base((int)SyntaxKind.EndOfLineTrivia)
ExtractMethod\Extensions.cs (9)
128if (!modifiersGetter(decl).Any(SyntaxKind.ConstKeyword)) 147if (token.Kind() != SyntaxKind.ThrowKeyword) 181case SyntaxKind.RegionDirectiveTrivia: 184case SyntaxKind.EndRegionDirectiveTrivia: 192case SyntaxKind.IfDirectiveTrivia: 195case SyntaxKind.EndIfDirectiveTrivia: 203case SyntaxKind.ElseDirectiveTrivia: 204case SyntaxKind.ElifDirectiveTrivia: 262if (token1.RawKind != (int)SyntaxKind.SemicolonToken || !(token1.Parent is FieldDeclarationSyntax))
GenerateConstructors\CSharpGenerateConstructorsCodeRefactoringProvider.cs (1)
65var getAccessor = propertyDeclaration.AccessorList?.Accessors.FirstOrDefault(a => a.Kind() == SyntaxKind.GetAccessorDeclaration);
GenerateEqualsAndGetHashCodeFromMembers\CSharpGenerateEqualsAndGetHashCodeService.cs (1)
27wrappedStatements = [SyntaxFactory.CheckedStatement(SyntaxKind.UncheckedStatement,
GenerateMember\GenerateVariable\CSharpGenerateVariableService.cs (16)
51var contextualKind = SyntaxFacts.GetContextualKeywordKind(token.ValueText); 53return contextualKind is SyntaxKind.FromKeyword or 54SyntaxKind.NameOfKeyword or 55SyntaxKind.AsyncKeyword or 56SyntaxKind.AwaitKeyword or 57SyntaxKind.VarKeyword; 143if (identifierName.IsKind(SyntaxKind.GenericName)) 165return parsedType.IsKind(SyntaxKind.GenericName) && !parsedType.ContainsDiagnostics; 176if (expression.IsParentKind(SyntaxKind.AttributeArgument)) 181if (expression.IsParentKind(SyntaxKind.ConditionalAccessExpression)) 186if (expression.IsParentKind(SyntaxKind.IsPatternExpression)) 191if (expression.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) && 192expression.Parent.IsParentKind(SyntaxKind.Subpattern)) 197if (expression.IsParentKind(SyntaxKind.ConstantPattern)) 209if (node.IsLeftSideOfAssignExpression() && node.Parent.IsParentKind(SyntaxKind.ExpressionStatement))
GenerateType\CSharpGenerateTypeService.cs (33)
43=> expression.IsParentKind(SyntaxKind.CatchDeclaration); 47return expression.IsParentKind(SyntaxKind.ArrayType) && 48expression.Parent.IsParentKind(SyntaxKind.ArrayCreationExpression); 96SyntaxKind.InterfaceDeclaration or 97SyntaxKind.StructDeclaration or 98SyntaxKind.RecordStructDeclaration; 134if (usingDirectiveSyntax != null && usingDirectiveSyntax.StaticKeyword.Kind() != SyntaxKind.StaticKeyword) 141if (simpleName.IsParentKind(SyntaxKind.NameMemberCref)) 150SyntaxKind.QualifiedName or 151SyntaxKind.IdentifierName or 152SyntaxKind.AliasQualifiedName or 153SyntaxKind.GenericName or 154SyntaxKind.SimpleMemberAccessExpression)) 166nameOrMemberAccessExpression.Parent.IsParentKind(SyntaxKind.BaseList) && 168nameOrMemberAccessExpression.Parent.Parent.IsParentKind(SyntaxKind.EnumDeclaration)) 204if (nameOrMemberAccessExpression == null || !nameOrMemberAccessExpression.IsKind(SyntaxKind.SimpleMemberAccessExpression) || !simpleName.IsRightSideOfDot()) 213!token.IsKind(SyntaxKind.DotToken)) 229if (token.IsKind(SyntaxKind.DotToken) && 249nextToken.IsKind(SyntaxKind.DotToken)) 264if (nextToken.IsKind(SyntaxKind.DotToken)) 296if (nextToken.IsKind(SyntaxKind.DotToken)) 317if ((nameOrMemberAccessExpression.IsKind(SyntaxKind.SimpleMemberAccessExpression) || (nameOrMemberAccessExpression.Parent != null && nameOrMemberAccessExpression.IsParentKind(SyntaxKind.SimpleMemberAccessExpression))) 322if (nameOrMemberAccessExpression.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 328Debug.Assert(nameOrMemberAccessExpression.IsParentKind(SyntaxKind.SimpleMemberAccessExpression)); 332outerMostMemberAccessExpression = outerMostMemberAccessExpression.GetAncestorsOrThis<ExpressionSyntax>().SkipWhile(n => n != null && n.IsKind(SyntaxKind.SimpleMemberAccessExpression)).FirstOrDefault(); 370objectCreationExpressionOpt.ArgumentList.Arguments is [{ Expression: (kind: not SyntaxKind.DeclarationExpression) expression }]) 643if (baseList.Parent.Kind() is SyntaxKind.InterfaceDeclaration or SyntaxKind.StructDeclaration or SyntaxKind.RecordStructDeclaration) 674return typeDecl.GetModifiers().Any(SyntaxKind.PublicKeyword) && IsAllContainingTypeDeclsPublic(typeDecl); 687node.GetModifiers().Any(SyntaxKind.PublicKeyword) && 703|| containingTypeDeclarations.All(typedecl => typedecl.GetModifiers().Any(SyntaxKind.PublicKeyword));
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (13)
34case SyntaxKind.ContinueKeyword: 41case SyntaxKind.BreakKeyword: 42if (token.GetPreviousToken().IsKind(SyntaxKind.YieldKeyword)) 44goto case SyntaxKind.YieldKeyword; 53case SyntaxKind.YieldKeyword: 54case SyntaxKind.ReturnKeyword: 72case SyntaxKind.GotoKeyword: 73case SyntaxKind.DefaultKeyword: 74case SyntaxKind.CaseKeyword: 94var kind = node.Kind(); 97SyntaxFacts.GetTypeDeclarationKind(kind) != SyntaxKind.None) 113SyntaxFacts.GetTypeDeclarationKind(node.Kind()) != SyntaxKind.None) 128if (SyntaxFacts.GetTypeDeclarationKind(node.Kind()) != SyntaxKind.None)
Highlighting\KeywordHighlighters\AsyncAwaitHighlighter.cs (5)
31=> tokens.Any(static t => t.Kind() is SyntaxKind.AwaitKeyword or SyntaxKind.AsyncKeyword); 78localDeclaration.UsingKeyword.Kind() == SyntaxKind.UsingKeyword && TryAddAsyncOrAwaitKeyword(localDeclaration.AwaitKeyword, spans), 99if (mod.Kind() is SyntaxKind.AsyncKeyword or SyntaxKind.AwaitKeyword)
Highlighting\KeywordHighlighters\IfStatementHighlighter.cs (3)
29=> tokens.Any(static t => t.Kind() is SyntaxKind.IfKeyword or SyntaxKind.ElseKeyword); 34if (ifStatement.Parent.Kind() != SyntaxKind.ElseClause)
Highlighting\KeywordHighlighters\LoopHighlighter.cs (7)
27is SyntaxKind.DoKeyword 28or SyntaxKind.ForKeyword 29or SyntaxKind.ForEachKeyword 30or SyntaxKind.WhileKeyword 31or SyntaxKind.BreakKeyword 32or SyntaxKind.ContinueKeyword 33or SyntaxKind.SemicolonToken);
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (11)
28is SyntaxKind.SwitchKeyword 29or SyntaxKind.CaseKeyword 30or SyntaxKind.DefaultKeyword 31or SyntaxKind.SemicolonToken 32or SyntaxKind.BreakKeyword 33or SyntaxKind.GotoKeyword 34or SyntaxKind.ColonToken); 72if (gotoStatement.Kind() is SyntaxKind.GotoCaseStatement or SyntaxKind.GotoDefaultStatement || 76var end = !gotoStatement.CaseOrDefaultKeyword.IsKind(SyntaxKind.None) 92var highlightGotosForChild = highlightGotos && !child.IsKind(SyntaxKind.SwitchStatement);
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (1)
137if (span.IsEmpty && token.Kind() == SyntaxKind.OpenParenToken)
InheritanceMargin\CSharpInheritanceMarginService.cs (6)
43SyntaxKind.MethodDeclaration or 44SyntaxKind.PropertyDeclaration or 45SyntaxKind.EventDeclaration or 46SyntaxKind.IndexerDeclaration or 47SyntaxKind.OperatorDeclaration or 48SyntaxKind.ConversionOperatorDeclaration)
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs (2)
47if (selectedParameter.Parent is not ParameterListSyntax { Parent: TypeDeclarationSyntax(kind: SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration) typeDeclaration })
InlineHints\CSharpInlineParameterNameHintsService.cs (2)
94PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfix => GetKind(postfix.Operand), 105var keywordKind = SyntaxFacts.GetKeywordKind(parameterName);
InlineHints\CSharpInlineTypeHintsService.cs (1)
80return parameterNode.Parent?.Parent?.Kind() is SyntaxKind.ParenthesizedLambdaExpression
IntroduceUsingStatement\CSharpIntroduceUsingStatementCodeRefactoringProvider.cs (1)
107.WithUsingKeyword(Token(declarationStatement.GetLeadingTrivia(), SyntaxKind.UsingKeyword, [Space]));
IntroduceVariable\CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs (2)
47expressionStatement.Expression.IsKind(SyntaxKind.IdentifierName)) 115SyntaxKind.SimpleAssignmentExpression,
IntroduceVariable\CSharpIntroduceVariableService.cs (11)
51=> expression.GetAncestorOrThis<EqualsValueClauseSyntax>().IsParentKind(SyntaxKind.Parameter); 57=> expression.GetAncestorOrThis<EqualsValueClauseSyntax>().IsParentKind(SyntaxKind.PropertyDeclaration); 66if (node.IsKind(SyntaxKind.Block)) 70else if (node.IsKind(SyntaxKind.ArrowExpressionClause)) 88if (!expression.DepthFirstTraversal().Any(n => n.RawKind == (int)SyntaxKind.ArrayCreationExpression) && 89!expression.DepthFirstTraversal().Any(n => n.RawKind == (int)SyntaxKind.TypeOfExpression)) 94if (!attributeDecl.IsParentKind(SyntaxKind.CompilationUnit)) 111if (expression.WalkUpParentheses().IsParentKind(SyntaxKind.ExpressionStatement)) 117if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 123if (expression.IsKind(SyntaxKind.ThrowExpression)) 143return localFunction != null && localFunction.Modifiers.Any(SyntaxKind.StaticKeyword);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceField.cs (2)
47? MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, ParseName(typeDisplayString), IdentifierName(newNameToken)) 168=> member is FieldDeclarationSyntax field && field.Modifiers.Any(SyntaxKind.ConstKeyword);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (14)
270.WithAccessorList(AccessorList([AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, body)])) 271.TryWithSemicolonToken(Token(SyntaxKind.None)), 275.WithSemicolonToken(Token(SyntaxKind.None)), 279.WithSemicolonToken(Token(SyntaxKind.None)), 283.WithSemicolonToken(Token(SyntaxKind.None)), 303if (localFunction is { Body: not null } && localFunction.Modifiers.Any(SyntaxKind.StaticKeyword)) 372if (localFunction != null && !localFunction.Modifiers.Any(SyntaxKind.StaticKeyword)) 449var localFunctions = innermostCommonBlock.DescendantNodes().Where(node => node.IsKind(SyntaxKind.LocalFunctionStatement) && matches.Any(match => match.Span.OverlapsWith(node.Span))); 462!invocationExpression.Expression.IsKind(SyntaxKind.SimpleMemberAccessExpression) && 490if (!priorToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) && 491!nextStatement.GetLastToken().TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia)) 505var precedingEndOfLine = nextStatementLeading.LastOrDefault(t => t.Kind() == SyntaxKind.EndOfLineTrivia); 519if (nextStatementLeading is [(kind: SyntaxKind.WhitespaceTrivia) indentation]) 524nextStatement.GetTrailingTrivia() is [.., (kind: SyntaxKind.EndOfLineTrivia) endOfLine] ? endOfLine : ElasticCarriageReturnLineFeed);
InvertIf\CSharpInvertIfCodeRefactoringProvider.cs (21)
28SyntaxKind, 42=> ifNode?.Parent is (kind: SyntaxKind.Block or SyntaxKind.SwitchSection); 54=> node.Kind() is SyntaxKind.Block or SyntaxKind.SwitchSection; 57=> node.Kind() is SyntaxKind.Block or SyntaxKind.EmptyStatement; 101protected override SyntaxKind? GetJumpStatementKind(SyntaxNode node) 105=> SyntaxKind.BreakStatement, 107=> node.ContainsYield() ? SyntaxKind.YieldBreakStatement : SyntaxKind.ReturnStatement, 109=> SyntaxKind.ReturnStatement, 111=> SyntaxKind.ContinueStatement, 115protected override StatementSyntax GetJumpStatement(SyntaxKind kind) 118SyntaxKind.ContinueStatement => ContinueStatement(), 119SyntaxKind.BreakStatement => BreakStatement(), 120SyntaxKind.ReturnStatement => ReturnStatement(), 121SyntaxKind.YieldBreakStatement => YieldStatement(SyntaxKind.YieldBreakStatement), 227return trivia.Kind() is SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineCommentTrivia;
InvertLogical\CSharpInvertLogicalCodeRefactoringProvider.cs (5)
16AbstractInvertLogicalCodeRefactoringProvider<SyntaxKind, ExpressionSyntax, BinaryExpressionSyntax> 24protected override string GetOperatorText(SyntaxKind binaryExprKind) 25=> binaryExprKind == SyntaxKind.LogicalAndExpression 26? SyntaxFacts.GetText(SyntaxKind.AmpersandAmpersandToken) 27: SyntaxFacts.GetText(SyntaxKind.BarBarToken);
LanguageServices\CSharpStructuralTypeDisplayService.cs (4)
37members.Add(Keyword(SyntaxFacts.GetText(SyntaxKind.NewKeyword))); 39members.Add(Punctuation(SyntaxFacts.GetText(SyntaxKind.OpenBraceToken))); 47members.Add(Punctuation(SyntaxFacts.GetText(SyntaxKind.CommaToken))); 58members.Add(Punctuation(SyntaxFacts.GetText(SyntaxKind.CloseBraceToken)));
LineSeparators\CSharpLineSeparatorService.cs (10)
78case SyntaxKind.NamespaceDeclaration: 79case SyntaxKind.MethodDeclaration: 80case SyntaxKind.PropertyDeclaration: 81case SyntaxKind.EventDeclaration: 82case SyntaxKind.IndexerDeclaration: 83case SyntaxKind.ConstructorDeclaration: 84case SyntaxKind.DestructorDeclaration: 85case SyntaxKind.OperatorDeclaration: 86case SyntaxKind.ConversionOperatorDeclaration: 304if (lastChild.IsParentKind(SyntaxKind.CompilationUnit))
MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeRefactoringProvider.cs (1)
37if (localFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
MetadataAsSource\CSharpMetadataAsSourceService.cs (3)
140var keyword = enable ? SyntaxKind.EnableKeyword : SyntaxKind.DisableKeyword;
MetadataAsSource\FormattingRule.cs (5)
27if ((previousToken.Kind() != SyntaxKind.SemicolonToken && previousToken.Kind() != SyntaxKind.CloseBraceToken) || 28currentToken.Kind() == SyntaxKind.CloseBraceToken) 38if (previousToken.Kind() == SyntaxKind.SemicolonToken && previousToken.Parent.Kind() == SyntaxKind.UsingDirective)
Organizing\Organizers\MemberDeclarationsOrganizer.Comparer.cs (28)
91var xIsStatic = x.GetModifiers().Any(SyntaxKind.StaticKeyword); 92var yIsStatic = y.GetModifiers().Any(SyntaxKind.StaticKeyword); 122if (xModifiers.Any(SyntaxKind.PublicKeyword)) 126else if (xModifiers.Any(SyntaxKind.ProtectedKeyword) && xModifiers.Any(SyntaxKind.InternalKeyword)) 130else if (xModifiers.Any(SyntaxKind.InternalKeyword)) 134else if (xModifiers.Any(SyntaxKind.ProtectedKeyword)) 148case SyntaxKind.FieldDeclaration: 150case SyntaxKind.EventFieldDeclaration: 152case SyntaxKind.ConstructorDeclaration: 154case SyntaxKind.DestructorDeclaration: 156case SyntaxKind.PropertyDeclaration: 158case SyntaxKind.EventDeclaration: 160case SyntaxKind.IndexerDeclaration: 162case SyntaxKind.OperatorDeclaration: 164case SyntaxKind.ConversionOperatorDeclaration: 166case SyntaxKind.MethodDeclaration: 168case SyntaxKind.ClassDeclaration: 169case SyntaxKind.InterfaceDeclaration: 170case SyntaxKind.StructDeclaration: 171case SyntaxKind.EnumDeclaration: 172case SyntaxKind.DelegateDeclaration: 173case SyntaxKind.RecordDeclaration: 174case SyntaxKind.RecordStructDeclaration: 189case SyntaxKind.ConstructorDeclaration: 190case SyntaxKind.DestructorDeclaration: 191case SyntaxKind.IndexerDeclaration: 192case SyntaxKind.OperatorDeclaration:
Organizing\Organizers\ModifiersOrganizer.Comparer.cs (6)
37[t => t.Kind() == SyntaxKind.PartialKeyword, t => GetOrdering(t)]; 43case SyntaxKind.StaticKeyword: 45case SyntaxKind.PrivateKeyword: 46case SyntaxKind.ProtectedKeyword: 47case SyntaxKind.InternalKeyword: 48case SyntaxKind.PublicKeyword:
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (2)
47=> token.IsKind(SyntaxKind.EndOfDirectiveToken) 67LiteralExpressionSyntax(SyntaxKind.NumericLiteralExpression) literal
QuickInfo\CSharpSemanticQuickInfoProvider.cs (10)
42if (token.IsKind(SyntaxKind.EqualsGreaterThanToken) 43&& token.Parent is (kind: SyntaxKind.ParenthesizedLambdaExpression or SyntaxKind.SimpleLambdaExpression)) 49else if (token.IsKind(SyntaxKind.DelegateKeyword) && token.Parent.IsKind(SyntaxKind.AnonymousMethodExpression)) 62if (token.Kind() is SyntaxKind.CloseBracketToken or SyntaxKind.OpenBracketToken && 63token.Parent?.Parent.IsKind(SyntaxKind.ElementAccessExpression) == true) 75if (token.IsKind(SyntaxKind.DotToken) && 87=> !token.Parent.IsKind(SyntaxKind.XmlCrefAttribute);
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (15)
35case SyntaxKind.CloseBraceToken: 37case SyntaxKind.HashToken: 38case SyntaxKind.EndRegionKeyword: 39case SyntaxKind.EndIfKeyword: 40case SyntaxKind.ElseKeyword: 41case SyntaxKind.ElifKeyword: 42case SyntaxKind.EndOfDirectiveToken: 60var openBrace = parent.ChildNodesAndTokens().FirstOrDefault(n => n.Kind() == SyntaxKind.OpenBraceToken).AsToken(); 61if (openBrace.Kind() != SyntaxKind.OpenBraceToken) 89=> node.IsKind(SyntaxKind.Block) 90&& node.Parent?.Kind() is SyntaxKind.Block or SyntaxKind.SwitchSection or SyntaxKind.GlobalStatement; 121else if (trivia.Kind() is not SyntaxKind.WhitespaceTrivia and not SyntaxKind.EndOfLineTrivia)
RawStringLiteral\CSharpRawStringLiteralOnAutoInsertService.cs (12)
63if (token.Kind() is not (SyntaxKind.StringLiteralToken or 64SyntaxKind.InterpolatedStringStartToken or 65SyntaxKind.InterpolatedSingleLineRawStringStartToken or 66SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 115if (token.Kind() is not (SyntaxKind.SingleLineRawStringLiteralToken or 116SyntaxKind.MultiLineRawStringLiteralToken or 117SyntaxKind.InterpolatedSingleLineRawStringStartToken or 118SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 162if (token.Kind() is SyntaxKind.InterpolatedSingleLineRawStringStartToken or SyntaxKind.InterpolatedMultiLineRawStringStartToken) 169else if (token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken)
RemoveUnusedVariable\CSharpRemoveUnusedVariableCodeFixProvider.cs (4)
37if (node.Kind() == SyntaxKind.SimpleAssignmentExpression) 40if (parent.Kind() == SyntaxKind.ExpressionStatement) 57case SyntaxKind.SimpleAssignmentExpression: 61RemoveNode(editor, node.IsParentKind(SyntaxKind.GlobalStatement) ? node.Parent : node, blockFacts);
Rename\CSharpRenameIssuesService.cs (1)
59if (parent.IsKind(SyntaxKind.IdentifierName))
ReplaceDocCommentTextWithTag\CSharpReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (5)
24=> token.Kind() is SyntaxKind.XmlTextLiteralToken or SyntaxKind.XmlTextLiteralNewLineToken; 27=> token.GetRequiredParent().Kind() is SyntaxKind.XmlCrefAttribute or SyntaxKind.XmlNameAttribute or SyntaxKind.XmlTextAttribute;
ReplaceMethodWithProperty\CSharpReplaceMethodWithPropertyService.cs (12)
74if (propertyDeclaration.AccessorList is { Accessors: [(kind: SyntaxKind.GetAccessorDeclaration) getAccessor] }) 102AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) 138if (setMethodDeclaration?.Modifiers.Any(SyntaxKind.UnsafeKeyword) == true 139&& !property.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 196createReturnStatementForExpression: accessorDeclaration.Kind() == SyntaxKind.GetAccessorDeclaration, 213var accessor = AccessorDeclaration(SyntaxKind.GetAccessorDeclaration); 221if (getMethodDeclaration.SemicolonToken.Kind() != SyntaxKind.None) 252var accessor = AccessorDeclaration(SyntaxKind.SetAccessorDeclaration); 269if (setMethodDeclaration.SemicolonToken.Kind() != SyntaxKind.None) 322invocation.ArgumentList.Arguments[0].Expression.Kind() == SyntaxKind.DeclarationExpression) 344SyntaxKind.SimpleAssignmentExpression, currentInvocation.Expression, argumentExpression); 359if (nameToken.Kind() != SyntaxKind.IdentifierToken)
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (33)
129if (propertyDeclaration.Modifiers.Any(SyntaxKind.UnsafeKeyword) 130&& !methodDeclaration.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 189if (propertyDeclaration.Modifiers.Any(SyntaxKind.UnsafeKeyword) 190&& !methodDeclaration.Modifiers.Any(SyntaxKind.UnsafeKeyword)) 246return trivia.Kind() is SyntaxKind.MultiLineDocumentationCommentTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia 333var operatorKind = parent.Kind() switch 335SyntaxKind.AddAssignmentExpression => SyntaxKind.AddExpression, 336SyntaxKind.AndAssignmentExpression => SyntaxKind.BitwiseAndExpression, 337SyntaxKind.CoalesceAssignmentExpression => SyntaxKind.CoalesceExpression, 338SyntaxKind.DivideAssignmentExpression => SyntaxKind.DivideExpression, 339SyntaxKind.ExclusiveOrAssignmentExpression => SyntaxKind.ExclusiveOrExpression, 340SyntaxKind.LeftShiftAssignmentExpression => SyntaxKind.LeftShiftExpression, 341SyntaxKind.ModuloAssignmentExpression => SyntaxKind.ModuloExpression, 342SyntaxKind.MultiplyAssignmentExpression => SyntaxKind.MultiplyExpression, 343SyntaxKind.OrAssignmentExpression => SyntaxKind.BitwiseOrExpression, 344SyntaxKind.RightShiftAssignmentExpression => SyntaxKind.RightShiftExpression, 345SyntaxKind.SubtractAssignmentExpression => SyntaxKind.SubtractExpression, 346SyntaxKind.UnsignedRightShiftAssignmentExpression => SyntaxKind.UnsignedRightShiftExpression, 347_ => SyntaxKind.None, 350if (operatorKind is SyntaxKind.None)
ReverseForStatement\CSharpReverseForStatementCodeRefactoringProvider.cs (40)
142if (condition.Kind() is SyntaxKind.LessThanExpression or 143SyntaxKind.LessThanOrEqualExpression) 146equals = condition.Kind() == SyntaxKind.LessThanOrEqualExpression; 151if (condition.Kind() is SyntaxKind.GreaterThanExpression or 152SyntaxKind.GreaterThanOrEqualExpression) 155equals = condition.Kind() == SyntaxKind.GreaterThanOrEqualExpression; 171postfixUnary.Kind() == SyntaxKind.PostIncrementExpression && 178prefixUnary.Kind() == SyntaxKind.PreIncrementExpression && 185assignment.Kind() == SyntaxKind.AddAssignmentExpression && 210if (condition.Kind() == SyntaxKind.GreaterThanOrEqualExpression) 217if (condition.Kind() == SyntaxKind.LessThanOrEqualExpression) 234postfixUnary.Kind() == SyntaxKind.PostDecrementExpression && 241prefixUnary.Kind() == SyntaxKind.PreDecrementExpression && 248assignment.Kind() == SyntaxKind.SubtractAssignmentExpression && 322if ((outerBinary.Kind() == SyntaxKind.SubtractExpression && innerLeft.Kind() == SyntaxKind.AddExpression) || 323(outerBinary.Kind() == SyntaxKind.AddExpression && innerLeft.Kind() == SyntaxKind.SubtractExpression)) 333if (outerBinary.Kind() == SyntaxKind.LessThanOrEqualExpression && 335innerRight.Kind() == SyntaxKind.SubtractExpression && 343if (outerBinary.Kind() == SyntaxKind.GreaterThanOrEqualExpression && 345innerLeft.Kind() == SyntaxKind.SubtractExpression && 365var newOperatorKind = condition.Kind() is SyntaxKind.LessThanExpression or SyntaxKind.LessThanOrEqualExpression 366? SyntaxKind.GreaterThanEqualsToken 367: SyntaxKind.LessThanEqualsToken; 369var newExpressionKind = newOperatorKind == SyntaxKind.GreaterThanEqualsToken 370? SyntaxKind.GreaterThanOrEqualExpression 371: SyntaxKind.LessThanOrEqualExpression; 387var newKind = opToken.Kind() switch 389SyntaxKind.MinusMinusToken => SyntaxKind.PlusPlusToken, 390SyntaxKind.PlusPlusToken => SyntaxKind.MinusMinusToken, 391SyntaxKind.PlusEqualsToken => SyntaxKind.MinusEqualsToken, 392SyntaxKind.MinusEqualsToken => SyntaxKind.PlusEqualsToken,
SignatureHelp\AbstractCSharpSignatureHelpProvider.cs (4)
18protected static SymbolDisplayPart Keyword(SyntaxKind kind) 21protected static SymbolDisplayPart Operator(SyntaxKind kind) 24protected static SymbolDisplayPart Punctuation(SyntaxKind kind) 38Punctuation(SyntaxKind.CommaToken),
SignatureHelp\AbstractGenericNameSignatureHelpProvider.cs (13)
208parts.Add(Keyword(SyntaxKind.WhereKeyword)); 214parts.Add(Punctuation(SyntaxKind.ColonToken)); 222parts.Add(Keyword(SyntaxKind.ClassKeyword)); 232parts.Add(Keyword(SyntaxKind.StructKeyword)); 240parts.Add(Punctuation(SyntaxKind.CommaToken)); 253parts.Add(Punctuation(SyntaxKind.CommaToken)); 257parts.Add(Keyword(SyntaxKind.NewKeyword)); 258parts.Add(Punctuation(SyntaxKind.OpenParenToken)); 259parts.Add(Punctuation(SyntaxKind.CloseParenToken)); 267parts.Add(Punctuation(SyntaxKind.CommaToken)); 271parts.Add(Keyword(SyntaxKind.AllowsKeyword)); 273parts.Add(Keyword(SyntaxKind.RefKeyword)); 275parts.Add(Keyword(SyntaxKind.StructKeyword));
SignatureHelp\AbstractGenericNameSignatureHelpProvider_Method.cs (13)
24result.Add(Punctuation(SyntaxKind.OpenParenToken)); 26result.Add(Punctuation(SyntaxKind.CommaToken)); 28result.Add(Punctuation(SyntaxKind.CloseParenToken)); 33result.Add(Punctuation(SyntaxKind.OpenParenToken)); 35result.Add(Punctuation(SyntaxKind.CloseParenToken)); 40result.Add(Punctuation(SyntaxKind.OpenParenToken)); 42result.Add(Punctuation(SyntaxKind.CloseParenToken)); 52result.Add(Punctuation(SyntaxKind.DotToken)); 56result.Add(Punctuation(SyntaxKind.LessThanToken)); 78Punctuation(SyntaxKind.GreaterThanToken), 79Punctuation(SyntaxKind.OpenParenToken) 87result.Add(Punctuation(SyntaxKind.CommaToken)); 95result.Add(Punctuation(SyntaxKind.CloseParenToken));
SignatureHelp\AbstractGenericNameSignatureHelpProvider_NamedType.cs (2)
16return [.. namedType.ToMinimalDisplayParts(semanticModel, position, MinimallyQualifiedWithoutTypeParametersFormat), Punctuation(SyntaxKind.LessThanToken)]; 20=> [Punctuation(SyntaxKind.GreaterThanToken)];
SignatureHelp\AbstractOrdinaryMethodSignatureHelpProvider.cs (9)
60result.Add(Punctuation(SyntaxKind.OpenParenToken)); 62result.Add(Punctuation(SyntaxKind.CommaToken)); 64result.Add(Punctuation(SyntaxKind.CloseParenToken)); 69result.Add(Punctuation(SyntaxKind.OpenParenToken)); 71result.Add(Punctuation(SyntaxKind.CloseParenToken)); 76result.Add(Punctuation(SyntaxKind.OpenParenToken)); 78result.Add(Punctuation(SyntaxKind.CloseParenToken)); 83result.Add(Punctuation(SyntaxKind.OpenParenToken)); 89=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\AttributeSignatureHelpProvider.cs (5)
58return !token.IsKind(SyntaxKind.None) && 183Punctuation(SyntaxKind.EqualsToken), 206Punctuation(SyntaxKind.ColonToken), 219return [.. method.ContainingType.ToMinimalDisplayParts(semanticModel, position), Punctuation(SyntaxKind.OpenParenToken)]; 223=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\ConstructorInitializerSignatureHelpProvider.cs (3)
74var type = constructorInitializer.Kind() == SyntaxKind.BaseConstructorInitializer 147return [.. method.ContainingType.ToMinimalDisplayParts(semanticModel, position), Punctuation(SyntaxKind.OpenParenToken)]; 151=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (10)
64expression.IsKind(SyntaxKind.NullableType) && 246result.Add(Keyword(SyntaxKind.RefKeyword)); 251result.Add(Keyword(SyntaxKind.RefKeyword)); 253result.Add(Keyword(SyntaxKind.ReadOnlyKeyword)); 263result.Add(Punctuation(SyntaxKind.DotToken)); 267result.Add(Punctuation(SyntaxKind.OpenBracketToken)); 273=> [Punctuation(SyntaxKind.CloseBracketToken)]; 279return !token.IsKind(SyntaxKind.None) && 328return !token.IsKind(SyntaxKind.None) && 363return !token.IsKind(SyntaxKind.None) &&
SignatureHelp\GenericNameFullyWrittenSignatureHelpProvider.cs (1)
44return !token.IsKind(SyntaxKind.None) &&
SignatureHelp\InitializerExpressionSignatureHelpProvider.cs (1)
47=> !token.IsKind(SyntaxKind.None) &&
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_DelegateAndFunctionPointerInvoke.cs (4)
66displayParts.Add(Keyword(SyntaxKind.DelegateKeyword)); 67displayParts.Add(Operator(SyntaxKind.AsteriskToken)); 74displayParts.Add(Punctuation(SyntaxKind.OpenParenToken)); 98=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (4)
60var includeInstance = throughExpression.Kind() is not (SyntaxKind.IdentifierName or SyntaxKind.SimpleMemberAccessExpression or SyntaxKind.PredefinedType) || 65(throughExpression.IsKind(SyntaxKind.IdentifierName) &&
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider_DelegateType.cs (5)
41result.Add(Punctuation(SyntaxKind.OpenParenToken)); 53parts.Add(Punctuation(SyntaxKind.OpenParenToken)); 60parts.Add(Punctuation(SyntaxKind.CommaToken)); 68parts.Add(Punctuation(SyntaxKind.CloseParenToken)); 80=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider_NormalType.cs (2)
45result.Add(Punctuation(SyntaxKind.OpenParenToken)); 51=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\PrimaryConstructorBaseTypeSignatureHelpProvider.cs (2)
145result.Add(Punctuation(SyntaxKind.OpenParenToken)); 151=> [Punctuation(SyntaxKind.CloseParenToken)];
SignatureHelp\SignatureHelpUtilities.cs (3)
104if (token.IsKind(SyntaxKind.OpenParenToken) && 131if (token.IsKind(SyntaxKind.CommaToken) && token.Parent is TupleExpressionSyntax && token.GetAncestor<TSyntaxNode>() != null) 136return !token.IsKind(SyntaxKind.None) &&
SignatureHelp\TupleConstructionSignatureHelpProvider.cs (1)
226=> token.IsKind(SyntaxKind.OpenParenToken) && token.Parent is ParenthesizedExpressionSyntax;
SimplifyThisOrMe\CSharpSimplifyThisOrMeDiagnosticAnalyzer.cs (1)
20SyntaxKind,
SimplifyTypeNames\SimplifyTypeNamesCodeFixProvider.cs (3)
25: AbstractSimplifyTypeNamesCodeFixProvider<SyntaxKind, CSharpSimplifierOptions>(new CSharpSimplifyTypeNamesDiagnosticAnalyzer()) 52if (annotatedexpressionSyntax.Kind() is SyntaxKind.IsExpression or SyntaxKind.AsExpression)
Snippets\AbstractCSharpForLoopSnippetProvider.cs (2)
35protected abstract SyntaxKind ConditionKind { get; } 37protected abstract SyntaxKind IncrementorKind { get; }
Snippets\AbstractCSharpTypeSnippetProvider.cs (6)
30protected abstract ISet<SyntaxKind> ValidModifiers { get; } 64preferredOrder.TryGetValue((int)SyntaxKind.PublicKeyword, out var publicModifierOrder)) 66while (targetToken.IsPotentialModifier(out var modifierKind)) 79targetPosition = targetToken.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword) ? targetToken.SpanStart : targetPosition; 81return new TextChange(TextSpan.FromBounds(targetPosition, targetPosition), SyntaxFacts.GetText(SyntaxKind.PublicKeyword) + " "); 106typeDeclaration.CloseBraceToken.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, indentationString)));
Snippets\CSharpClassSnippetProvider.cs (14)
21private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.NewKeyword, 24SyntaxKind.PublicKeyword, 25SyntaxKind.ProtectedKeyword, 26SyntaxKind.InternalKeyword, 27SyntaxKind.PrivateKeyword, 28SyntaxKind.AbstractKeyword, 29SyntaxKind.ClosedKeyword, 30SyntaxKind.SealedKeyword, 31SyntaxKind.StaticKeyword, 32SyntaxKind.UnsafeKeyword, 33SyntaxKind.FileKeyword, 40protected override ISet<SyntaxKind> ValidModifiers => s_validModifiers;
Snippets\CSharpConsoleSnippetProvider.cs (1)
35if (syntaxContext.TargetToken is { RawKind: (int)SyntaxKind.EqualsGreaterThanToken, Parent: LambdaExpressionSyntax lambda })
Snippets\CSharpConstructorSnippetProvider.cs (8)
30private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 32SyntaxKind.PublicKeyword, 33SyntaxKind.PrivateKeyword, 34SyntaxKind.ProtectedKeyword, 35SyntaxKind.InternalKeyword, 36SyntaxKind.StaticKeyword, 46precedingModifiers.Count == 1 && precedingModifiers.Single() == SyntaxKind.StaticKeyword))
Snippets\CSharpEnumSnippetProvider.cs (8)
21private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.InternalKeyword, 24SyntaxKind.PublicKeyword, 25SyntaxKind.PrivateKeyword, 26SyntaxKind.ProtectedKeyword, 27SyntaxKind.FileKeyword, 34protected override ISet<SyntaxKind> ValidModifiers => s_validModifiers;
Snippets\CSharpForEachLoopSnippetProvider.cs (4)
47if (token is { RawKind: (int)SyntaxKind.AwaitKeyword, Parent: ExpressionSyntax { Parent: ExpressionStatementSyntax } } || 48token is { RawKind: (int)SyntaxKind.IdentifierToken, ValueText: "await", Parent: IdentifierNameSyntax { Parent: ExpressionStatementSyntax } }) 70var isAsync = syntaxContext.TargetToken is { RawKind: (int)SyntaxKind.AwaitKeyword } or { RawKind: (int)SyntaxKind.IdentifierToken, ValueText: "await" };
Snippets\CSharpForLoopSnippetProvider.cs (4)
25protected override SyntaxKind ConditionKind => SyntaxKind.LessThanExpression; 27protected override SyntaxKind IncrementorKind => SyntaxKind.PostIncrementExpression;
Snippets\CSharpInterfaceSnippetProvider.cs (9)
21private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.InternalKeyword, 24SyntaxKind.PublicKeyword, 25SyntaxKind.PrivateKeyword, 26SyntaxKind.ProtectedKeyword, 27SyntaxKind.UnsafeKeyword, 28SyntaxKind.FileKeyword, 35protected override ISet<SyntaxKind> ValidModifiers => s_validModifiers;
Snippets\CSharpIntMainSnippetProvider.cs (1)
60var updatedReturnStatement = returnStatement.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, indentationString));
Snippets\CSharpPropiSnippetProvider.cs (1)
29=> SyntaxFactory.AccessorDeclaration(SyntaxKind.InitAccessorDeclaration).WithSemicolonToken(SemicolonToken);
Snippets\CSharpProprSnippetProvider.cs (5)
43if (precedingModifiers.IsSupersetOf([SyntaxKind.ProtectedKeyword, SyntaxKind.InternalKeyword])) 47if (precedingModifiers.Any(syntaxKind => syntaxKind is SyntaxKind.PrivateKeyword or SyntaxKind.ProtectedKeyword)) 62return SyntaxFactory.AccessorDeclaration(SyntaxKind.InitAccessorDeclaration).WithSemicolonToken(SemicolonToken);
Snippets\CSharpReversedForLoopSnippetProvider.cs (4)
25protected override SyntaxKind ConditionKind => SyntaxKind.GreaterThanOrEqualExpression; 27protected override SyntaxKind IncrementorKind => SyntaxKind.PostDecrementExpression;
Snippets\CSharpSnippetHelpers.cs (1)
55var updatedBlock = block.WithCloseBraceToken(block.CloseBraceToken.WithPrependedLeadingTrivia(SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, indentationString)));
Snippets\CSharpStructSnippetProvider.cs (11)
21private static readonly ISet<SyntaxKind> s_validModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.InternalKeyword, 24SyntaxKind.PublicKeyword, 25SyntaxKind.PrivateKeyword, 26SyntaxKind.ProtectedKeyword, 27SyntaxKind.UnsafeKeyword, 28SyntaxKind.RefKeyword, 29SyntaxKind.ReadOnlyKeyword, 30SyntaxKind.FileKeyword, 37protected override ISet<SyntaxKind> ValidModifiers => s_validModifiers;
SolutionExplorer\CSharpSolutionExplorerSymbolTreeItemProvider.cs (5)
202var isExtension = methodDeclaration.IsParentKind(SyntaxKind.ExtensionBlockDeclaration) || 203(methodDeclaration.ParameterList is { Parameters: [var parameter, ..] } && parameter.Modifiers.Any(SyntaxKind.ThisKeyword)); 227var isConst = fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 274nameBuilder.Append(operatorDeclaration.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword 294if (declaration.Kind() == SyntaxKind.DestructorDeclaration)
SpellCheck\CSharpSpellcheckCodeFixProvider.cs (1)
60=> token.GetNextToken().Kind() == SyntaxKind.LessThanToken;
SplitOrMergeIfStatements\CSharpIfLikeStatementGenerator.cs (1)
171if (statement.IsKind(SyntaxKind.IfStatement))
SplitStringLiteral\InterpolatedStringSplitter.cs (3)
34=> _interpolatedStringExpression.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken; 75SyntaxKind.AddExpression, 87kind: SyntaxKind.InterpolatedStringTextToken,
SplitStringLiteral\SimpleStringSplitter.cs (5)
33return _token.IsKind(SyntaxKind.Utf8StringLiteralToken) && CursorPosition >= _token.Span.End - "u8".Length; 46var firstTokenSuffix = _token.Kind() == SyntaxKind.Utf8StringLiteralToken 64var leftExpression = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, firstToken); 65var rightExpression = SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, secondToken); 68SyntaxKind.AddExpression,
SplitStringLiteral\StringSplitter.cs (7)
28SyntaxKind.PlusToken, 42if (token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.Utf8StringLiteralToken) 61if (token.Kind() is SyntaxKind.InterpolatedStringTextToken or SyntaxKind.InterpolatedStringEndToken || 72return token.Kind() == SyntaxKind.OpenBraceToken && 73token.Parent.IsKind(SyntaxKind.Interpolation) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\AddAccessibilityModifiers\CSharpAddAccessibilityModifiers.cs (9)
33if (name.Kind() == SyntaxKind.None) 86case SyntaxKind.CompilationUnit: 87case SyntaxKind.FileScopedNamespaceDeclaration: 88case SyntaxKind.NamespaceDeclaration: 92case SyntaxKind.ClassDeclaration: 93case SyntaxKind.RecordDeclaration: 94case SyntaxKind.StructDeclaration: 95case SyntaxKind.RecordStructDeclaration: 99case SyntaxKind.InterfaceDeclaration:
src\roslyn\src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (23)
33SyntaxKind.IfStatement, 34SyntaxKind.ElseClause, 35SyntaxKind.ForStatement, 36SyntaxKind.ForEachStatement, 37SyntaxKind.ForEachVariableStatement, 38SyntaxKind.WhileStatement, 39SyntaxKind.DoStatement, 40SyntaxKind.UsingStatement, 41SyntaxKind.LockStatement, 42SyntaxKind.FixedStatement); 62case SyntaxKind.Block: 66case SyntaxKind.IfStatement when statement.Kind() == SyntaxKind.ElseClause: 77case SyntaxKind.LockStatement: 78case SyntaxKind.UsingStatement: 79case SyntaxKind.FixedStatement: 238if (statement.Kind() is not (SyntaxKind.IfStatement or SyntaxKind.ElseClause)) 267if (ifStatementOrElseClause.IsKind(SyntaxKind.ElseClause)) 273Debug.Assert(ifStatementOrElseClause.IsKind(SyntaxKind.IfStatement)); 277while (result.IsParentKind(SyntaxKind.ElseClause)) 292if (statement.Statement.IsKind(SyntaxKind.Block)) 296if (elseStatement.IsKind(SyntaxKind.Block))
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredExpressionParenthesesDiagnosticAnalyzer.cs (26)
18ExpressionSyntax, ExpressionSyntax, SyntaxKind>(CSharpExpressionPrecedenceService.Instance) 20private static readonly ImmutableArray<SyntaxKind> s_kinds = 22SyntaxKind.AddExpression, 23SyntaxKind.SubtractExpression, 24SyntaxKind.MultiplyExpression, 25SyntaxKind.DivideExpression, 26SyntaxKind.ModuloExpression, 27SyntaxKind.LeftShiftExpression, 28SyntaxKind.RightShiftExpression, 29SyntaxKind.LogicalOrExpression, 30SyntaxKind.LogicalAndExpression, 31SyntaxKind.BitwiseOrExpression, 32SyntaxKind.BitwiseAndExpression, 33SyntaxKind.ExclusiveOrExpression, 34SyntaxKind.EqualsExpression, 35SyntaxKind.NotEqualsExpression, 36SyntaxKind.LessThanExpression, 37SyntaxKind.LessThanOrEqualExpression, 38SyntaxKind.GreaterThanExpression, 39SyntaxKind.GreaterThanOrEqualExpression, 40SyntaxKind.IsExpression, 41SyntaxKind.AsExpression, 42SyntaxKind.CoalesceExpression, 43SyntaxKind.IsPatternExpression, 46protected override ImmutableArray<SyntaxKind> GetSyntaxNodeKinds() 81=> node.Kind() == SyntaxKind.AsExpression;
src\roslyn\src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer.cs (5)
18PatternSyntax, BinaryPatternSyntax, SyntaxKind>(CSharpPatternPrecedenceService.Instance) 20private static readonly ImmutableArray<SyntaxKind> s_kinds = [SyntaxKind.AndPattern, SyntaxKind.OrPattern]; 22protected override ImmutableArray<SyntaxKind> GetSyntaxNodeKinds()
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToBlockScopedNamespaceDiagnosticAnalyzer.cs (1)
29=> context.RegisterSyntaxNodeAction(AnalyzeNamespace, SyntaxKind.FileScopedNamespaceDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertNamespace\ConvertToFileScopedNamespaceDiagnosticAnalyzer.cs (1)
29=> context.RegisterSyntaxNodeAction(AnalyzeNamespace, SyntaxKind.NamespaceDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_ProgramMain.cs (1)
66var lastPragma = root.GetFirstToken().LeadingTrivia.LastOrDefault(t => t.Kind() is SyntaxKind.PragmaWarningDirectiveTrivia);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertProgramAnalysis_TopLevelStatements.cs (5)
58if (!methodDeclaration.Modifiers.Any(SyntaxKind.StaticKeyword) || 132if (member.Modifiers.Any(m => m.Kind() is SyntaxKind.PublicKeyword or SyntaxKind.ProtectedKeyword or SyntaxKind.InternalKeyword)) 135if (!member.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToProgramMainDiagnosticAnalyzer.cs (1)
38context.RegisterSyntaxNodeAction(ProcessCompilationUnit, SyntaxKind.CompilationUnit);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertProgram\ConvertToTopLevelStatementsDiagnosticAnalyzer.cs (1)
44context.RegisterSyntaxNodeAction(ProcessCompilationUnit, SyntaxKind.CompilationUnit);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (33)
20private sealed class Analyzer : CSharpSyntaxVisitor<SyntaxKind> 31public static (SyntaxKind nodeToGenerate, VariableDeclaratorSyntax? declaratorToRemoveOpt) Analyze( 37var nodeToGenerate = analyzer.AnalyzeSwitchStatement(node, out shouldRemoveNextStatement); 39if (nodeToGenerate == SyntaxKind.SimpleAssignmentExpression && 84if (!_assignmentTargetOpt.IsKind(SyntaxKind.IdentifierName)) 104public override SyntaxKind VisitSwitchStatement(SwitchStatementSyntax node) 107private SyntaxKind AnalyzeSwitchStatement(SwitchStatementSyntax switchStatement, out bool shouldRemoveNextStatement) 126var nextStatement = AnalyzeNextStatement(switchStatement, out shouldRemoveNextStatement); 175private SyntaxKind AnalyzeNextStatement(SwitchStatementSyntax switchStatement, out bool shouldRemoveNextStatement) 182return SyntaxKind.ThrowStatement; 190private static SyntaxKind Intersect(SyntaxKind left, SyntaxKind right) 192if (left == SyntaxKind.ThrowStatement) 197if (right == SyntaxKind.ThrowStatement) 210private SyntaxKind AnalyzeNextStatement(StatementSyntax? nextStatement) 213return nextStatement is (kind: SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement) 218private SyntaxKind AnalyzeSwitchSection(SwitchSectionSyntax section) 223case 2 when section.Statements[1].IsKind(SyntaxKind.BreakStatement) || section.Statements[0].IsKind(SyntaxKind.SwitchStatement): 230private static SyntaxKind Aggregate<T>(SyntaxKind seed, SyntaxList<T> nodes, Func<SyntaxKind, T, SyntaxKind> func) 233var result = seed; 248public override SyntaxKind VisitAssignmentExpression(AssignmentExpressionSyntax node) 268public override SyntaxKind VisitExpressionStatement(ExpressionStatementSyntax node) 271public override SyntaxKind VisitReturnStatement(ReturnStatementSyntax node) 279: SyntaxKind.ReturnStatement; 282public override SyntaxKind VisitThrowStatement(ThrowStatementSyntax node) 286return node.Expression is null ? default : SyntaxKind.ThrowStatement; 289public override SyntaxKind DefaultVisit(SyntaxNode node)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs (1)
34context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.SwitchStatement);
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionHelpers.cs (4)
14if (node.IsKind(SyntaxKind.DefaultSwitchLabel)) 22if (@case.Pattern.IsKind(SyntaxKind.DiscardPattern)) 30varPattern.Designation.Kind() is SyntaxKind.DiscardDesignation or SyntaxKind.SingleVariableDesignation)
src\roslyn\src\Analyzers\CSharp\Analyzers\ConvertTypeofToNameof\CSharpConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
36and not { Type: PredefinedTypeSyntax { Keyword.RawKind: (int)SyntaxKind.VoidKeyword } };
src\roslyn\src\Analyzers\CSharp\Analyzers\FileHeaders\CSharpFileHeaderHelper.cs (2)
22if (commentTrivia.IsKind(SyntaxKind.SingleLineCommentTrivia)) 26else if (commentTrivia.IsKind(SyntaxKind.MultiLineCommentTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\ForEachCast\CSharpForEachCastDiagnosticAnalyzer.cs (4)
17SyntaxKind, 23protected override ImmutableArray<SyntaxKind> GetSyntaxKinds() 24=> [SyntaxKind.ForEachStatement, SyntaxKind.ForEachVariableStatement];
src\roslyn\src\Analyzers\CSharp\Analyzers\HiddenExplicitCast\CSharpHiddenExplicitCastDiagnosticAnalyzer.cs (1)
30=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.CastExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (13)
57compilationContext.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 59syntaxContext => AnalyzeSyntaxNode(syntaxContext, expressionType), SyntaxKind.Argument)); 81if (argumentNode.RefOrOutKeyword.Kind() != SyntaxKind.OutKeyword) 102if (invocationOrCreation?.Kind() is not SyntaxKind.InvocationExpression and not SyntaxKind.ObjectCreationExpression) 293case SyntaxKind.WhileStatement: 294case SyntaxKind.DoStatement: 295case SyntaxKind.ForStatement: 296case SyntaxKind.ForEachStatement: 297case SyntaxKind.UsingStatement: 298case SyntaxKind.FixedStatement: 299case SyntaxKind.TryStatement: 318return current.IsParentKind(SyntaxKind.Block)
src\roslyn\src\Analyzers\CSharp\Analyzers\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessAnalyzer.cs (7)
35=> context.RegisterSyntaxNodeAction(SyntaxNodeAction, SyntaxKind.IfStatement); 56if (!ifStatement.Condition.IsKind(SyntaxKind.NotEqualsExpression)) 119if (condition.Left.IsKind(SyntaxKind.NullLiteralExpression) || 120condition.Right.IsKind(SyntaxKind.NullLiteralExpression)) 122var expr = condition.Left.IsKind(SyntaxKind.NullLiteralExpression) 309=> left.IsKind(SyntaxKind.IdentifierName) && right.IsKind(SyntaxKind.NullLiteralExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeAnonymousFunctionStatic\MakeAnonymousFunctionStaticDiagnosticAnalyzer.cs (4)
35context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression); 46if (anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeFieldReadonly\CSharpMakeFieldReadonlyDiagnosticAnalyzer.cs (1)
15: AbstractMakeFieldReadonlyDiagnosticAnalyzer<SyntaxKind, ThisExpressionSyntax>
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeLocalFunctionStatic\MakeLocalFunctionStaticDiagnosticAnalyzer.cs (2)
32context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.LocalFunctionStatement); 38if (localFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
186property.Modifiers.Any(SyntaxKind.ReadOnlyKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\MakeStructReadOnly\CSharpMakeStructReadOnlyDiagnosticAnalyzer.cs (1)
51}, SyntaxKind.ThisExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\MatchFolderAndNamespace\CSharpMatchFolderAndNamespaceDiagnosticAnalyzer.cs (4)
24: AbstractMatchFolderAndNamespaceDiagnosticAnalyzer<SyntaxKind, BaseNamespaceDeclarationSyntax> 36protected override ImmutableArray<SyntaxKind> GetSyntaxKindsToAnalyze() 37=> [SyntaxKind.NamespaceDeclaration, SyntaxKind.FileScopedNamespaceDeclaration];
src\roslyn\src\Analyzers\CSharp\Analyzers\MisplacedUsingDirectives\MisplacedUsingDirectivesDiagnosticAnalyzer.cs (6)
53context.RegisterSyntaxNodeAction(AnalyzeNamespaceNode, SyntaxKind.NamespaceDeclaration, SyntaxKind.FileScopedNamespaceDeclaration); 54context.RegisterSyntaxNodeAction(AnalyzeCompilationUnitNode, SyntaxKind.CompilationUnit); 103t => t.Kind() is not (SyntaxKind.UsingDirective or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration));
src\roslyn\src\Analyzers\CSharp\Analyzers\NamingStyle\CSharpNamingStyleDiagnosticAnalyzer.cs (9)
15internal sealed class CSharpNamingStyleDiagnosticAnalyzer : NamingStyleDiagnosticAnalyzerBase<SyntaxKind> 17protected override ImmutableArray<SyntaxKind> SupportedSyntaxKinds { get; } = 19SyntaxKind.VariableDeclarator, 20SyntaxKind.ForEachStatement, 21SyntaxKind.CatchDeclaration, 22SyntaxKind.SingleVariableDesignation, 23SyntaxKind.LocalFunctionStatement, 24SyntaxKind.Parameter, 25SyntaxKind.TypeParameter,
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementDiagnosticAnalyzer.cs (5)
101if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 111SyntaxKind.IfDirectiveTrivia or SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementDiagnosticAnalyzer.cs (6)
33=> context.RegisterSyntaxNodeAction(ProcessConditionalExpression, SyntaxKind.ConditionalExpression); 77if (token.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 87SyntaxKind.IfDirectiveTrivia or SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementDiagnosticAnalyzer.cs (3)
98if (!token.IsKind(SyntaxKind.CloseBraceToken)) 102if (!nextToken.IsKind(SyntaxKind.CloseBraceToken)) 127endOfLineTrivia = secondBrace.LeadingTrivia.Last(t => t.IsKind(SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementDiagnosticAnalyzer.cs (1)
86if (colonToken.TrailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia)
src\roslyn\src\Analyzers\CSharp\Analyzers\NewLines\EmbeddedStatementPlacement\EmbeddedStatementPlacementDiagnosticAnalyzer.cs (4)
93var parentIsElseClause = parent.IsKind(SyntaxKind.ElseClause); 99if (statement.IsKind(SyntaxKind.IfStatement) && parentIsElseClause) 111if (parent.IsKind(SyntaxKind.Block)) 133if (trivia.IsKind(SyntaxKind.EndOfLineTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\OrderModifiers\CSharpOrderModifiersHelper.cs (3)
21var kind = SyntaxFacts.GetKeywordKind(trimmed); 22return (int)(kind == SyntaxKind.None ? SyntaxFacts.GetContextualKeywordKind(trimmed) : kind); 31parsed[(int)SyntaxKind.PartialKeyword] = int.MaxValue;
src\roslyn\src\Analyzers\CSharp\Analyzers\QualifyMemberAccess\CSharpQualifyMemberAccessDiagnosticAnalyzer.cs (6)
18: AbstractQualifyMemberAccessDiagnosticAnalyzer<SyntaxKind, ExpressionSyntax, SimpleNameSyntax> 24=> node.IsKind(SyntaxKind.ThisExpression); 38if (node.IsKind(SyntaxKind.BaseExpression)) 44if (node.Parent is AssignmentExpressionSyntax { Parent: InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression), Left: var left } && 62=> declarationSyntax.IsKind(SyntaxKind.PropertyDeclaration) && declarationSyntax.Contains(node); 65=> declarationSyntax.GetAncestorsOrThis(n => n.IsKind(SyntaxKind.FieldDeclaration) && n.Contains(node)).Any();
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionDiagnosticAnalyzer.cs (3)
26=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.IsExpression, SyntaxKind.IsPatternExpression); 38if (left.Kind() != SyntaxKind.SuppressNullableWarningExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryAsyncModifier\CSharpMakeMethodSynchronousDiagnosticAnalyzer.cs (1)
90if (modifier.Kind() == SyntaxKind.AsyncKeyword)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryCast\CSharpRemoveUnnecessaryCastDiagnosticAnalyzer.cs (4)
20: AbstractRemoveUnnecessaryCastDiagnosticAnalyzer<SyntaxKind, ExpressionSyntax> 22protected override ImmutableArray<SyntaxKind> SyntaxKindsOfInterest { get; } = 23[SyntaxKind.CastExpression, SyntaxKind.AsExpression];
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationDiagnosticAnalyzer.cs (1)
40context.RegisterSyntaxNodeAction(AnalyzeDiscardDesignation, SyntaxKind.DiscardDesignation);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryLambdaExpression\CSharpRemoveUnnecessaryLambdaExpressionDiagnosticAnalyzer.cs (5)
50SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression); 75if (anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword)) 83if (wasAwaited != anonymousFunction.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveDiagnosticAnalyzer.cs (14)
55if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia)) 96case SyntaxKind.NullableDirectiveTrivia: 107case SyntaxKind.IfDirectiveTrivia or 108SyntaxKind.ElifDirectiveTrivia or 109SyntaxKind.ElseDirectiveTrivia or 110SyntaxKind.EndIfDirectiveTrivia: 120if (!directive.TargetToken.IsKind(SyntaxKind.None)) 128if (directive.TargetToken.IsKind(SyntaxKind.AnnotationsKeyword)) 132else if (directive.TargetToken.IsKind(SyntaxKind.WarningsKeyword)) 141if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 145else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 155if (directive.SettingToken.IsKind(SyntaxKind.EnableKeyword)) 159else if (directive.SettingToken.IsKind(SyntaxKind.DisableKeyword)) 163else if (directive.SettingToken.IsKind(SyntaxKind.RestoreKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (13)
56SyntaxKind.CompilationUnit or 57SyntaxKind.ClassDeclaration or 58SyntaxKind.RecordDeclaration or 59SyntaxKind.StructDeclaration or 60SyntaxKind.RecordStructDeclaration or 61SyntaxKind.InterfaceDeclaration or 62SyntaxKind.DelegateDeclaration or 63SyntaxKind.EnumDeclaration; 135SyntaxKind.IfDirectiveTrivia or 136SyntaxKind.ElifDirectiveTrivia or 137SyntaxKind.ElseDirectiveTrivia) 272if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia)) 293if (!root.ContainsDirective(SyntaxKind.NullableDirectiveTrivia))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\NullableImpactingSpanWalker.cs (5)
73if (node.IsParentKind(SyntaxKind.UsingDirective)) 79if (node.IsParentKind(SyntaxKind.SimpleBaseType)) 91if (node.IsParentKind(SyntaxKind.NameEquals) && node.Parent.IsParentKind(SyntaxKind.UsingDirective)) 101if (node.IsParentKind(SyntaxKind.Attribute))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryParentheses\CSharpRemoveUnnecessaryExpressionParenthesesDiagnosticAnalyzer.cs (3)
19: AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer<SyntaxKind, ParenthesizedExpressionSyntax> 21protected override SyntaxKind GetSyntaxKind() 22=> SyntaxKind.ParenthesizedExpression;
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryParentheses\CSharpRemoveUnnecessaryPatternParenthesesDiagnosticAnalyzer.cs (3)
19: AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer<SyntaxKind, ParenthesizedPatternSyntax> 21protected override SyntaxKind GetSyntaxKind() 22=> SyntaxKind.ParenthesizedPattern;
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs (3)
22case SyntaxKind.AssemblyKeyword: 23case SyntaxKind.ModuleKeyword: 31}, SyntaxKind.AttributeList);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\CSharpRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (2)
24=> (typeof(SyntaxKind).Assembly, CompilerDiagnosticAnalyzerNames.CSharpCompilerAnalyzerTypeName); 26=> root.ContainsDirective(SyntaxKind.PragmaWarningDirectiveTrivia);
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessarySuppressions\UnnecessaryNullableWarningSuppressionsUtilities.cs (1)
26if (node is not PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfixUnary)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryUnsafeModifier\UnnecessaryUnsafeModifierUtilities.cs (1)
145if (modifier.Kind() == SyntaxKind.UnsafeKeyword)
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnreachableCode\RemoveUnreachableCodeHelpers.cs (2)
64if (currentStatement.IsKind(SyntaxKind.LabeledStatement)) 74if (currentStatement.IsKind(SyntaxKind.LocalFunctionStatement))
src\roslyn\src\Analyzers\CSharp\Analyzers\RemoveUnusedParametersAndValues\CSharpRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (1)
79!blockOperation.Syntax.IsKind(SyntaxKind.Block);
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyBooleanExpression\CSharpSimplifyConditionalDiagnosticAnalyzer.cs (1)
18SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyLinqExpression\CSharpSimplifyLinqTypeCheckAndCastDiagnosticAnalyzer.cs (2)
35context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, enumerableType), SyntaxKind.InvocationExpression); 72if (whereLambda.Body is not BinaryExpressionSyntax(kind: SyntaxKind.IsExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorDiagnosticAnalyzer.cs (12)
30=> context.RegisterSyntaxNodeAction(AnalyzePropertyDeclaration, SyntaxKind.PropertyDeclaration); 50if (accessor is (SyntaxKind.GetAccessorDeclaration) { Body.Statements: [ReturnStatementSyntax { Expression.RawKind: (int)SyntaxKind.FieldExpression }] } 51or (SyntaxKind.GetAccessorDeclaration) { ExpressionBody.Expression.RawKind: (int)SyntaxKind.FieldExpression }) 57if (accessor is (SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration) { Body.Statements: [ExpressionStatementSyntax { Expression: var innerBlockBodyExpression }] } && 64if (accessor is (SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration) { ExpressionBody.Expression: var innerExpressionBodyExpression } && 73return expression is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) 75Left.RawKind: (int)SyntaxKind.FieldExpression, 86containingPropertyDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternDiagnosticAnalyzer.cs (1)
47context.RegisterSyntaxNodeAction(AnalyzeSubpattern, SyntaxKind.Subpattern);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseAutoProperty\CSharpUseAutoPropertyAnalyzer.cs (10)
21SyntaxKind, 29protected override SyntaxKind PropertyDeclarationKind 30=> SyntaxKind.PropertyDeclaration; 59if (argument.RefKindKeyword.Kind() != SyntaxKind.None) 75if (addressOfExpression.Kind() == SyntaxKind.AddressOfExpression) 155if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) 157Expression: (kind: SyntaxKind.ThisExpression), 158Name: (kind: SyntaxKind.IdentifierName), 163else if (expression.IsKind(SyntaxKind.IdentifierName)) 215if (setExpression is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForIfNullStatementCheckDiagnosticAnalyzer.cs (6)
19SyntaxKind, 25protected override SyntaxKind IfStatementKind 26=> SyntaxKind.IfStatement; 42if (condition is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) { Right: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } binary) 47else if (condition is IsPatternExpressionSyntax { Pattern: ConstantPatternSyntax { Expression: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } } isPattern)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCoalesceExpression\CSharpUseCoalesceExpressionForTernaryConditionalCheckDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\AbstractCSharpUseCollectionExpressionDiagnosticAnalyzer.cs (2)
43protected abstract void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType); 67context.RegisterCodeBlockStartAction<SyntaxKind>(context => InitializeWorker(context, expressionType));
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (3)
29protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 31context.RegisterSyntaxNodeAction(context => AnalyzeArrayInitializerExpression(context, expressionType), SyntaxKind.ArrayInitializerExpression); 32context.RegisterSyntaxNodeAction(context => AnalyzeArrayCreationExpression(context, expressionType), SyntaxKind.ArrayCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs (5)
32protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 33=> context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, expressionType), SyntaxKind.InvocationExpression); 110if (invocationExpression.Expression is not MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccessExpression || 149argumentIndex == arguments.Count - 1 && arguments[argumentIndex] is { RefKindKeyword.RawKind: (int)SyntaxKind.OutKeyword, Expression: DeclarationExpressionSyntax { Designation: SingleVariableDesignationSyntax singleVariable } } 216identifierName.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForCreateDiagnosticAnalyzer.cs (2)
22protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 23=> context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, expressionType), SyntaxKind.InvocationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForEmptyDiagnosticAnalyzer.cs (2)
23protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 24=> context.RegisterSyntaxNodeAction(context => AnalyzeMemberAccess(context, expressionType), SyntaxKind.SimpleMemberAccessExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (4)
65protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 66=> context.RegisterSyntaxNodeAction(context => AnalyzeMemberAccess(context, expressionType), SyntaxKind.SimpleMemberAccessExpression); 221Initializer: null or { RawKind: (int)SyntaxKind.CollectionInitializerExpression } 403if (memberAccess.Kind() != SyntaxKind.SimpleMemberAccessExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs (3)
26protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 28context.RegisterSyntaxNodeAction(context => AnalyzeObjectCreationExpression(context, expressionType), SyntaxKind.ObjectCreationExpression); 29context.RegisterSyntaxNodeAction(context => AnalyzeImplicitObjectCreationExpression(context, expressionType), SyntaxKind.ImplicitObjectCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForStackAllocDiagnosticAnalyzer.cs (3)
35protected override void InitializeWorker(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol? expressionType) 37context.RegisterSyntaxNodeAction(context => AnalyzeExplicitStackAllocExpression(context, expressionType), SyntaxKind.StackAllocArrayCreationExpression); 38context.RegisterSyntaxNodeAction(context => AnalyzeImplicitStackAllocExpression(context, expressionType), SyntaxKind.ImplicitStackAllocArrayCreationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (5)
580siblingArgument.RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword && 614if (openBracket.TrailingTrivia is [(kind: SyntaxKind.WhitespaceTrivia), ..]) 617if (elements is [.., var lastNodeOrToken] && lastNodeOrToken.GetTrailingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia)] trailingTrivia) 886RawKind: (int)SyntaxKind.SimpleMemberAccessExpression, 1041if (objectCreation.Initializer.IsKind(SyntaxKind.ObjectCreationExpression) && objectCreation.Initializer.Expressions.Count > 0)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerAnalyzer.cs (4)
37if (expression is InitializerExpressionSyntax(SyntaxKind.ComplexElementInitializerExpression) initializer) 54if (_objectCreationExpression.Initializer is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression) 201if (binaryExpression.Kind() != SyntaxKind.AddExpression) 250if (current is not MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) { Name.Identifier.ValueText: "Length" or "Count" } memberAccess)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCollectionInitializer\CSharpUseCollectionInitializerDiagnosticAnalyzer.cs (1)
27SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundAssignmentDiagnosticAnalyzer.cs (10)
15: AbstractUseCompoundAssignmentDiagnosticAnalyzer<SyntaxKind, AssignmentExpressionSyntax, BinaryExpressionSyntax>( 18protected override SyntaxKind GetAnalysisKind() 19=> SyntaxKind.SimpleAssignmentExpression; 21protected override bool IsSupported(SyntaxKind assignmentKind, ParseOptions options) 22=> assignmentKind != SyntaxKind.CoalesceExpression || 25protected override int TryGetIncrementOrDecrement(SyntaxKind opKind, object constantValue) 34SyntaxKind.AddExpression => 1, 35SyntaxKind.SubtractExpression => -1, 45SyntaxKind.AddExpression => -1, 46SyntaxKind.SubtractExpression => 1,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.cs (10)
44context.RegisterSyntaxNodeAction(AnalyzeCoalesceExpression, SyntaxKind.CoalesceExpression); 45context.RegisterSyntaxNodeAction(AnalyzeIfStatement, SyntaxKind.IfStatement); 71if (assignment.Kind() != SyntaxKind.SimpleAssignmentExpression) 108assignment = whenTrue is ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignmentTemp } 179if (condition is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) { Right: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } binaryExpression) 188else if (condition is IsPatternExpressionSyntax { Pattern: ConstantPatternSyntax { Expression: LiteralExpressionSyntax(SyntaxKind.NullLiteralExpression) } } isPattern) 198if (arg0.Kind() == SyntaxKind.NullLiteralExpression || 199arg1.Kind() == SyntaxKind.NullLiteralExpression) 204testedExpression = arg0.Kind() == SyntaxKind.NullLiteralExpression ? arg1 : arg0;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseCompoundAssignment\Utilities.cs (30)
11public static readonly ImmutableArray<(SyntaxKind, SyntaxKind, SyntaxKind)> Kinds = 13(SyntaxKind.AddExpression, SyntaxKind.AddAssignmentExpression), 14(SyntaxKind.SubtractExpression, SyntaxKind.SubtractAssignmentExpression), 15(SyntaxKind.MultiplyExpression, SyntaxKind.MultiplyAssignmentExpression), 16(SyntaxKind.DivideExpression, SyntaxKind.DivideAssignmentExpression), 17(SyntaxKind.ModuloExpression, SyntaxKind.ModuloAssignmentExpression), 18(SyntaxKind.BitwiseAndExpression, SyntaxKind.AndAssignmentExpression), 19(SyntaxKind.ExclusiveOrExpression, SyntaxKind.ExclusiveOrAssignmentExpression), 20(SyntaxKind.BitwiseOrExpression, SyntaxKind.OrAssignmentExpression), 21(SyntaxKind.LeftShiftExpression, SyntaxKind.LeftShiftAssignmentExpression), 22(SyntaxKind.RightShiftExpression, SyntaxKind.RightShiftAssignmentExpression), 23(SyntaxKind.CoalesceExpression, SyntaxKind.CoalesceAssignmentExpression)).SelectAsArray( 26private static SyntaxKind FindOperatorToken(SyntaxKind assignmentExpressionKind) 28for (var current = SyntaxKind.None; current <= SyntaxKind.ThrowExpression; current++)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseDeconstruction\CSharpUseDeconstructionDiagnosticAnalyzer.cs (3)
39SyntaxKind.VariableDeclaration, SyntaxKind.ForEachStatement); 233if (element.Identifier.IsKind(SyntaxKind.None))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseDefaultLiteral\CSharpUseDefaultLiteralDiagnosticAnalyzer.cs (1)
30=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.DefaultExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForAccessorsHelper.cs (7)
30SyntaxKind.GetAccessorDeclaration, 31SyntaxKind.SetAccessorDeclaration, 32SyntaxKind.InitAccessorDeclaration, 33SyntaxKind.AddAccessorDeclaration, 34SyntaxKind.RemoveAccessorDeclaration, 63return !declaration.GetLeadingTrivia().Any(t => t.Kind() == SyntaxKind.EndOfLineTrivia) 69=> declaration.IsKind(SyntaxKind.GetAccessorDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForConstructorsHelper.cs (1)
25[SyntaxKind.ConstructorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForConversionOperatorsHelper.cs (1)
25[SyntaxKind.ConversionOperatorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForIndexersHelper.cs (1)
28[SyntaxKind.IndexerDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForLocalFunctionHelper.cs (2)
28[SyntaxKind.LocalFunctionStatement]) 56if (statement.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForMethodsHelper.cs (2)
26[SyntaxKind.MethodDeclaration]) 54if (declaration.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForOperatorsHelper.cs (1)
27[SyntaxKind.OperatorDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyForPropertiesHelper.cs (1)
31[SyntaxKind.PropertyDeclaration])
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper.cs (1)
22public abstract ImmutableArray<SyntaxKind> SyntaxKinds { get; }
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (8)
34ImmutableArray<SyntaxKind> syntaxKinds) : UseExpressionBodyHelper 42public override ImmutableArray<SyntaxKind> SyntaxKinds { get; } = syntaxKinds; 46return accessorList is { Accessors: [{ AttributeLists.Count: 0, RawKind: (int)SyntaxKind.GetAccessorDeclaration } accessor] } 174getAccessor?.GetLeadingTrivia() is not [.., (kind: SyntaxKind.WhitespaceTrivia) whitespace]) 208if (startOfLine && trivia.IsKind(SyntaxKind.WhitespaceTrivia)) 247if (expressionBody.Expression.IsKind(SyntaxKind.ThrowExpression)) 290.Where(t => t.Kind() != SyntaxKind.EndOfLineTrivia) 384var accessor = AccessorDeclaration(SyntaxKind.GetAccessorDeclaration);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBody\UseExpressionBodyDiagnosticAnalyzer.cs (4)
20private readonly ImmutableArray<SyntaxKind> _syntaxKinds; 53var nodeKind = context.Node.Kind(); 60if (grandparent.Kind() == SyntaxKind.PropertyDeclaration && 66if (grandparent.Kind() == SyntaxKind.IndexerDeclaration &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaDiagnosticAnalyzer.cs (2)
35SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseExpressionBodyForLambda\UseExpressionBodyForLambdaHelpers.cs (1)
57if (expressionBodyOpt.IsKind(SyntaxKind.ThrowExpression) &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitlyTypedLambdaExpression\CSharpUseImplicitlyTypedLambdaExpressionDiagnosticAnalyzer.cs (2)
34SyntaxKind.ParenthesizedLambdaExpression); 124var paramsModifierIndex = parameter.Modifiers.IndexOf(SyntaxKind.ParamsKeyword);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitObjectCreation\CSharpUseImplicitObjectCreationDiagnosticAnalyzer.cs (6)
32=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.ObjectCreationExpression); 102else if (objectCreation.Parent.IsKind(SyntaxKind.ArrowExpressionClause)) 106LocalFunctionStatementSyntax localFunction => (localFunction.ReturnType, localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword)), 107MethodDeclarationSyntax method => (method.ReturnType, method.Modifiers.Any(SyntaxKind.AsyncKeyword)), 111AccessorDeclarationSyntax(SyntaxKind.GetAccessorDeclaration) { Parent: AccessorListSyntax { Parent: BasePropertyDeclarationSyntax baseProperty } } => (baseProperty.Type, false), 124else if (objectCreation.Parent is InitializerExpressionSyntax(kind: SyntaxKind.ArrayInitializerExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseImplicitOrExplicitType\CSharpTypeStyleDiagnosticAnalyzerBase.cs (3)
43HandleVariableDeclaration, SyntaxKind.VariableDeclaration, SyntaxKind.ForEachStatement, SyntaxKind.DeclarationExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UseInferredMemberName\CSharpUseInferredMemberNameDiagnosticAnalyzer.cs (4)
17=> context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.NameColon, SyntaxKind.NameEquals); 23case SyntaxKind.NameColon: 26case SyntaxKind.NameEquals:
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorDiagnosticAnalyzer.cs (4)
41context.RegisterSyntaxNodeAction(n => AnalyzeSyntax(n), SyntaxKind.EqualsExpression, SyntaxKind.NotEqualsExpression); 61var properties = binaryExpression.Kind() == SyntaxKind.EqualsExpression 73right.IsKind(SyntaxKind.NullLiteralExpression))
src\roslyn\src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer.cs (1)
14internal sealed class CSharpUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer : AbstractUseIsNullCheckForReferenceEqualsDiagnosticAnalyzer<SyntaxKind>
src\roslyn\src\Analyzers\CSharp\Analyzers\UseLocalFunction\CSharpUseLocalFunctionDiagnosticAnalyzer.cs (10)
71context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 73SyntaxKind.SimpleLambdaExpression, SyntaxKind.ParenthesizedLambdaExpression, SyntaxKind.AnonymousMethodExpression)); 330if (containingStatement.IsKind(SyntaxKind.LocalDeclarationStatement, out localDeclaration) && 357if (anonymousFunction?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Parent: ExpressionStatementSyntax expressionStatement } assignment) 359if (assignment.Left.IsKind(SyntaxKind.IdentifierName)) 383SyntaxKind.NullLiteralExpression or 384SyntaxKind.DefaultLiteralExpression or 385SyntaxKind.DefaultExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNameofInNullableAttribute\CSharpUseNameofInNullableAttributeDiagnosticAnalyzer.cs (2)
42context.RegisterSyntaxNodeAction(AnalyzeAttribute, SyntaxKind.Attribute); 78if (argument.Expression is not LiteralExpressionSyntax(SyntaxKind.StringLiteralExpression) and not InterpolatedStringExpressionSyntax)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseNullPropagation\CSharpUseNullPropagationDiagnosticAnalyzer.cs (4)
19SyntaxKind, 33protected override SyntaxKind IfStatementSyntaxKind 34=> SyntaxKind.IfStatement; 53if (pattern is UnaryPatternSyntax(SyntaxKind.NotPattern) notPattern)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseObjectInitializer\CSharpUseObjectInitializerDiagnosticAnalyzer.cs (1)
17SyntaxKind,
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (2)
54SyntaxKind.SimpleAssignmentExpression, 167if (target.Syntax.DescendantNodesAndSelf().OfType<ArgumentSyntax>().Any(a => a.RefKindKeyword.Kind() is SyntaxKind.RefKeyword))
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternCombinators\CSharpUsePatternCombinatorsDiagnosticAnalyzer.cs (3)
43SyntaxKind.LogicalAndExpression, 44SyntaxKind.LogicalOrExpression, 45SyntaxKind.LogicalNotExpression);
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (3)
48context.RegisterSyntaxNodeAction(context => AnalyzeAsExpression(context), SyntaxKind.AsExpression); 99if (binaryExpression.Kind() is SyntaxKind.EqualsExpression) 109else if (binaryExpression.Kind() is SyntaxKind.NotEqualsExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (20)
42Debug.Assert(localStatement.IsKind(SyntaxKind.LocalDeclarationStatement)); 43Debug.Assert(enclosingBlock.Kind() is SyntaxKind.Block or SyntaxKind.SwitchSection); 106var defAssignedWhenTrue = _comparison.Kind() is SyntaxKind.NotEqualsExpression or SyntaxKind.IsExpression; 114case SyntaxKind.LogicalAndExpression when !defAssignedWhenTrue: 115case SyntaxKind.LogicalOrExpression when defAssignedWhenTrue: 126case SyntaxKind.LogicalAndExpression: 127case SyntaxKind.LogicalOrExpression: 130case SyntaxKind.ParenthesizedExpression: 131case SyntaxKind.CastExpression: 135case SyntaxKind.EqualsValueClause: 136case SyntaxKind.VariableDeclarator: 137case SyntaxKind.VariableDeclaration: 140case SyntaxKind.LogicalNotExpression: 145case SyntaxKind.ConditionalExpression: 158case SyntaxKind.ForStatement: 169case SyntaxKind.WhileStatement: 173case SyntaxKind.IfStatement: 282if (_operand.Kind() == SyntaxKind.IdentifierName)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.cs (16)
47=> context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 49SyntaxKind.EqualsExpression, 50SyntaxKind.NotEqualsExpression, 51SyntaxKind.IsExpression, 52SyntaxKind.IsPatternExpression)); 277case SyntaxKind.IdentifierName: 286if (!initializerValue.IsKind(SyntaxKind.AsExpression, out asExpression)) 292case SyntaxKind.SimpleAssignmentExpression: 297if (!assignment.Right.IsKind(SyntaxKind.AsExpression, out asExpression) || 327private static ExpressionSyntax? GetNullCheckOperand(ExpressionSyntax left, SyntaxKind comparisonKind, SyntaxNode right) 329if (left.IsKind(SyntaxKind.NullLiteralExpression)) 336if (right.IsKind(SyntaxKind.NullLiteralExpression)) 344&& predefinedType.Keyword.IsKind(SyntaxKind.ObjectKeyword) 345&& comparisonKind == SyntaxKind.IsExpression) 352&& constantPattern.Expression.IsKind(SyntaxKind.NullLiteralExpression) 353&& comparisonKind == SyntaxKind.IsPatternExpression)
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpIsAndCastCheckDiagnosticAnalyzer.cs (6)
59context.RegisterCodeBlockStartAction<SyntaxKind>(blockStartContext => 60blockStartContext.RegisterSyntaxNodeAction(SyntaxNodeAction, SyntaxKind.IsExpression)); 95var ifStatementScope = ifStatement.Parent.IsKind(SyntaxKind.Block) 173if (!isExpression.Parent.IsKind(SyntaxKind.IfStatement, out ifStatement)) 186if (!firstStatement.IsKind(SyntaxKind.LocalDeclarationStatement, out localDeclarationStatement)) 197if (!declaratorValue.IsKind(SyntaxKind.CastExpression, out castExpression))
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpUseNotPatternDiagnosticAnalyzer.cs (3)
46context.RegisterSyntaxNodeAction(n => SyntaxNodeAction(n, expressionOfTType), SyntaxKind.LogicalNotExpression); 63if (node is not PrefixUnaryExpressionSyntax(SyntaxKind.LogicalNotExpression) 81BinaryExpressionSyntax(SyntaxKind.IsExpression) { Right: TypeSyntax type } isExpression
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePatternMatching\UsePatternMatchingHelpers.cs (7)
26if (asExpression.Kind() == SyntaxKind.AsExpression) 54if (conditionalAccessExpression.Parent is BinaryExpressionSyntax(SyntaxKind.EqualsExpression) parentBinaryExpression1 && 65SyntaxKind.NotEqualsExpression or 66SyntaxKind.GreaterThanExpression or 67SyntaxKind.GreaterThanOrEqualExpression or 68SyntaxKind.LessThanExpression or 69SyntaxKind.LessThanOrEqualExpression) parentBinaryExpression2 &&
src\roslyn\src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (5)
363if (constructorDeclaration.Initializer is null or (kind: SyntaxKind.BaseConstructorInitializer)) 377Debug.Assert(constructorDeclaration.Initializer.Kind() == SyntaxKind.ThisConstructorInitializer); 472if (assignmentExpression.Kind() != SyntaxKind.SimpleAssignmentExpression) 482MemberAccessExpressionSyntax(kind: SyntaxKind.SimpleMemberAccessExpression) { Expression: (kind: SyntaxKind.ThisExpression), Name: IdentifierNameSyntax identifierName } => identifierName,
src\roslyn\src\Analyzers\CSharp\Analyzers\UseSimpleUsingStatement\UseSimpleUsingStatementDiagnosticAnalyzer.cs (3)
74context.RegisterSyntaxNodeAction(AnalyzeSyntax, SyntaxKind.UsingStatement); 222=> priorStatement.Kind() is SyntaxKind.GotoStatement or 223SyntaxKind.LabeledStatement;
src\roslyn\src\Analyzers\CSharp\Analyzers\UseTupleSwap\CSharpUseTupleSwapDiagnosticAnalyzer.cs (2)
58SyntaxKind.LocalDeclarationStatement); 139if (assignmentStatement is not ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment })
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfDiagnosticAnalyzer.cs (2)
53SyntaxKind.InvocationExpression); 72if (argument.Kind() != SyntaxKind.OmittedTypeArgument)
src\roslyn\src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
109else if (elements is [{ Syntax.Parent: (kind: SyntaxKind.CollectionInitializerExpression) }, ..])
src\roslyn\src\Analyzers\CSharp\Analyzers\ValidateFormatString\CSharpValidateFormatStringDiagnosticAnalyzer.cs (1)
16AbstractValidateFormatStringDiagnosticAnalyzer<SyntaxKind>
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddInheritdoc\AddInheritdocCodeFixProvider.cs (8)
46if (node.Kind() is not SyntaxKind.MethodDeclaration and not SyntaxKind.PropertyDeclaration and not SyntaxKind.VariableDeclarator) 49if (node.IsKind(SyntaxKind.VariableDeclarator) && node is not { Parent.Parent: EventFieldDeclarationSyntax }) 81var xmlSpaceAfterTripleSlash = Token(leading: [DocumentationCommentExterior("///")], SyntaxKind.XmlTextLiteralToken, text: " ", valueText: " ", trailing: default); 85var xmlNewLineToken = Token(leading: default, SyntaxKind.XmlTextLiteralNewLineToken, text: newLine, valueText: newLine, trailing: default); 88kind: SyntaxKind.SingleLineDocumentationCommentTrivia, 107if (finalLeadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)])
src\roslyn\src\Analyzers\CSharp\CodeFixes\AddParameter\CSharpAddParameterCodeFixProvider.cs (1)
66if (constructorInitializer.IsKind(SyntaxKind.BaseConstructorInitializer))
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConditionalExpressionInStringInterpolation\CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider.cs (1)
86parenthesizedExpression.GetAncestor<InterpolatedStringExpressionSyntax>()?.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (21)
136if (stringLiteral.Kind() is SyntaxKind.InterpolatedStringTextToken) 138if (stringLiteral.GetRequiredParent() is not InterpolatedStringTextSyntax { Parent: InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedMultiLineRawStringStartToken) } interpolatedString }) 143else if (stringLiteral.Kind() is SyntaxKind.InterpolatedRawStringEndToken) 145if (stringLiteral.GetRequiredParent() is not InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedMultiLineRawStringStartToken) } interpolatedString) 150else if (stringLiteral.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 228if (token.IsKind(SyntaxKind.HashToken) && token.Parent!.Kind() is not (SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia)) 287if (firstBodyToken.Kind() != SyntaxKind.EndOfFileToken 307if (leadingTrivia is [(kind: SyntaxKind.EndOfLineTrivia), ..]) 313if (leadingTrivia is [(kind: SyntaxKind.WhitespaceTrivia), (kind: SyntaxKind.EndOfLineTrivia), ..]) 350var originalHadTrailingNewLine = namespaceDeclaration.GetTrailingTrivia() is [.., (kind: SyntaxKind.EndOfLineTrivia)]; 358if (trailingTrivia is not [.., (kind: SyntaxKind.EndOfLineTrivia)]) 367(kind: SyntaxKind.EndOfLineTrivia or SyntaxKind.EndIfDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia), 368(kind: SyntaxKind.EndOfLineTrivia) 388if (openBraceToken.TrailingTrivia is not [.., SyntaxTrivia(SyntaxKind.EndOfLineTrivia)]) 400if (!fileScopedNamespace.GetLastToken().GetNextTokenOrEndOfFile().IsKind(SyntaxKind.EndOfFileToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (5)
59var nodeToGenerate = (SyntaxKind)int.Parse(properties[Constants.NodeToGenerateKey]!); 99Debug.Assert(nextStatement.Kind() is SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement); 100editor.RemoveNode(nextStatement.IsParentKind(SyntaxKind.GlobalStatement) ? nextStatement.GetRequiredParent() : nextStatement);
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (17)
41SyntaxKind nodeToGenerate, 52var rewriter = new Rewriter(model, isAllThrowStatements: nodeToGenerate == SyntaxKind.ThrowStatement, cancellationToken); 68SyntaxKind nodeToGenerate, 73case SyntaxKind.ReturnStatement: 75Token(leadingTrivia, SyntaxKind.ReturnKeyword, trailing: default), 78case SyntaxKind.ThrowStatement: 80Token(leadingTrivia, SyntaxKind.ThrowKeyword, trailing: default), 93private ExpressionStatementSyntax GenerateAssignment(ExpressionSyntax switchExpression, SyntaxKind assignmentKind, SyntaxTriviaList leadingTrivia) 151totalPattern = BinaryPattern(SyntaxKind.OrPattern, totalPattern.Parenthesize(), nextPatternPart.Parenthesize()); 162case SyntaxKind.CasePatternSwitchLabel: 167case SyntaxKind.CaseSwitchLabel: 171case SyntaxKind.DefaultSwitchLabel: 208Debug.Assert(!statements[0].IsKind(SyntaxKind.BreakStatement)); 234if (nextStatement is (kind: SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement)) 250Token(leading: default, SyntaxKind.SwitchKeyword, node.CloseParenToken.TrailingTrivia), 251Token(leading: default, SyntaxKind.OpenBraceToken, node.OpenBraceToken.TrailingTrivia),
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToAsync\CSharpConvertToAsyncMethodCodeFixProvider.cs (2)
65var invocationExpression = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.InvocationExpression)); 87if (!methodDeclaration.Modifiers.Any(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordEngine.cs (14)
37if (typeDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword)) 191SyntaxKind.ThisConstructorInitializer, 201=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.EqualsEqualsToken }); 203=> member is OperatorDeclarationSyntax { OperatorToken.RawKind: (int)SyntaxKind.ExclamationEqualsToken }); 418? SyntaxKind.RecordDeclaration 419: SyntaxKind.RecordStructDeclaration, 653SyntaxKind.MultiLineDocumentationCommentTrivia, 670SyntaxKind.MultiLineDocumentationCommentTrivia, 704if (docComment.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia)) 739if (prevToken.IsKind(SyntaxKind.XmlTextLiteralNewLineToken)) 796token.IsKind(SyntaxKind.XmlTextLiteralToken) 801tokens is [(kind: SyntaxKind.XmlTextLiteralNewLineToken), _, ..]) 811tokens is [.., (kind: SyntaxKind.XmlTextLiteralNewLineToken), (kind: SyntaxKind.XmlTextLiteralToken) textLiteral] &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\ConvertToRecord\ConvertToRecordHelpers.cs (2)
414? SyntaxKind.NullLiteralExpression 415: SyntaxKind.DefaultLiteralExpression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
153SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), newNameNode).WithAdditionalAnnotations(Simplifier.Annotation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpAddDocCommentNodesCodeFixProvider.cs (1)
42var docCommentNodes = leadingTrivia.Where(f => f.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia));
src\roslyn\src\Analyzers\CSharp\CodeFixes\DocumentationComments\CSharpRemoveDocCommentNodeCodeFixProvider.cs (2)
47=> token.Kind() == SyntaxKind.XmlTextLiteralToken && IsWhitespace(token.Text); 50=> token.Kind() == SyntaxKind.XmlTextLiteralNewLineToken;
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixIncorrectConstraint\CSharpFixIncorrectConstraintCodeFixProvider.cs (5)
52if (firstTrivia.Kind() != SyntaxKind.SkippedTokensTrivia) 60return enumOrDelegateKeyword.Kind() is SyntaxKind.EnumKeyword or SyntaxKind.DelegateKeyword; 85var isEnumConstraint = enumOrDelegateKeyword.Kind() is SyntaxKind.EnumKeyword; 104SyntaxKind.StructConstraint)));
src\roslyn\src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (3)
58=> typeSyntax is PredefinedTypeSyntax { Keyword.RawKind: (int)SyntaxKind.VoidKeyword }; 144MethodDeclarationSyntax method => (method.ReturnType, method.Modifiers.Any(SyntaxKind.AsyncKeyword)), 147LocalFunctionStatementSyntax localFunction => (localFunction.ReturnType, localFunction.Modifiers.Any(SyntaxKind.AsyncKeyword)),
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateConstructor\CSharpGenerateConstructorService.cs (2)
57typeToGenerateIn = constructorInitializer.IsKind(SyntaxKind.ThisConstructorInitializer) 188constructorDeclarationSyntax.Initializer.IsKind(SyntaxKind.ThisConstructorInitializer))
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateDefaultConstructors\CSharpGenerateDefaultConstructorsService.cs (2)
46if (baseList.Parent is TypeDeclarationSyntax(SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration) parentTypeDecl &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateEnumMember\CSharpGenerateEnumMemberService.cs (4)
42is SyntaxKind.InvocationExpression 43or SyntaxKind.ObjectCreationExpression 44or SyntaxKind.GotoStatement 45or SyntaxKind.AliasQualifiedName)
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateConversionCodeFixProvider.cs (4)
37is SyntaxKind.IdentifierName 38or SyntaxKind.MethodDeclaration 39or SyntaxKind.InvocationExpression 40or SyntaxKind.CastExpression ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (3)
46.FirstOrDefault(n => n.Kind() is SyntaxKind.SimpleAssignmentExpression or SyntaxKind.ForEachVariableStatement or SyntaxKind.PositionalPatternClause);
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateMethodCodeFixProvider.cs (4)
56is SyntaxKind.IdentifierName 57or SyntaxKind.MethodDeclaration 58or SyntaxKind.InvocationExpression 59or SyntaxKind.CastExpression ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateConversionService.cs (2)
66SyntaxKind.ImplicitKeyword, 92SyntaxKind.ImplicitKeyword,
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateMethodService.cs (1)
109if (simpleNameOrMemberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression, out invocationExpressionOpt))
src\roslyn\src\Analyzers\CSharp\CodeFixes\GenerateParameterizedMember\CSharpGenerateParameterizedMemberService.cs (2)
35=> _invocationExpression.IsParentKind(SyntaxKind.RefExpression) ? RefKind.Ref : RefKind.None; 137=> State.SimpleNameOpt.Kind() == SyntaxKind.IdentifierName;
src\roslyn\src\Analyzers\CSharp\CodeFixes\ImplementInterface\CSharpImplementInterfaceService.cs (4)
61SyntaxKind.ClassDeclaration or 62SyntaxKind.StructDeclaration or 63SyntaxKind.RecordDeclaration or 64SyntaxKind.RecordStructDeclaration) typeDeclaration)
src\roslyn\src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (2)
96if (ifStatement.Parent.IsKind(SyntaxKind.ElseClause) && 151var expressionTriviaWithoutEndOfLine = expressionTrivia.Where(t => !t.IsKind(SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (2)
76SyntaxKind.YieldReturnStatement, 220node = ancestors.FirstOrDefault(n => n.Span.Contains(span) && n != root && n.IsKind(SyntaxKind.ReturnStatement));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
161syntaxEditor.ReplaceNode(name, MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName("@this"), name));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMemberStatic\CSharpMakeMemberStaticCodeFixProvider.cs (1)
31if (node.IsKind(SyntaxKind.VariableDeclarator) && node.Parent is VariableDeclarationSyntax { Parent: FieldDeclarationSyntax or EventFieldDeclarationSyntax })
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (2)
51return token.Kind() == SyntaxKind.IdentifierToken && token.Text == "await"; 192var partialModifier = modifiers.FirstOrDefault(static m => m.IsKind(SyntaxKind.PartialKeyword));
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStatementAsynchronous\CSharpMakeStatementAsynchronousCodeFixProvider.cs (3)
97SyntaxKind.ForEachStatement or 98SyntaxKind.ForEachVariableStatement or 99SyntaxKind.UsingStatement))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
77if (otherAccessor.Modifiers.Any(SyntaxKind.ReadOnlyKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MakeTypeAbstract\CSharpMakeTypeAbstractCodeFixProvider.cs (4)
50if (enclosingType?.Kind() is SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration && 51!enclosingType.Modifiers.Any(SyntaxKind.AbstractKeyword) && !enclosingType.Modifiers.Any(SyntaxKind.StaticKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\MisplacedUsingDirectives\MisplacedUsingDirectivesCodeFixProvider.cs (2)
342.SkipWhile(trivia => trivia.All(t => t.IsWhitespaceOrEndOfLine()) && trivia.Last().IsKind(SyntaxKind.EndOfLineTrivia)) 376if (firstMemberTrivia is [(kind: SyntaxKind.EndOfLineTrivia), ..])
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
52Contract.ThrowIfTrue(arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
52Contract.ThrowIfTrue(questionToken.Kind() != SyntaxKind.QuestionToken);
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConsecutiveBracePlacement\ConsecutiveBracePlacementCodeFixProvider.cs (2)
68if (!token.IsKind(SyntaxKind.CloseBraceToken)) 75if (!firstBrace.IsKind(SyntaxKind.CloseBraceToken))
src\roslyn\src\Analyzers\CSharp\CodeFixes\NewLines\ConstructorInitializerPlacement\ConstructorInitializerPlacementCodeFixProvider.cs (1)
105return previousToken.TrailingTrivia.All(t => t.Kind() == SyntaxKind.WhitespaceTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\Nullable\CSharpDeclareAsNullableCodeFixProvider.cs (25)
66if (node.IsKind(SyntaxKind.ConditionalAccessExpression)) 116if (node.Parent is (kind: SyntaxKind.ReturnStatement or SyntaxKind.YieldReturnStatement)) 120SyntaxKind.MethodDeclaration or 121SyntaxKind.PropertyDeclaration or 122SyntaxKind.ParenthesizedLambdaExpression or 123SyntaxKind.SimpleLambdaExpression or 124SyntaxKind.LocalFunctionStatement or 125SyntaxKind.AnonymousMethodExpression or 126SyntaxKind.ConstructorDeclaration or 127SyntaxKind.DestructorDeclaration or 128SyntaxKind.OperatorDeclaration or 129SyntaxKind.IndexerDeclaration or 130SyntaxKind.EventDeclaration); 135var onYield = node.IsParentKind(SyntaxKind.YieldReturnStatement); 260if (node.IsParentKind(SyntaxKind.ArrowExpressionClause) && 271if (modifiers.Any(SyntaxKind.AsyncKeyword) || onYield) 316SyntaxKind.NullLiteralExpression or 317SyntaxKind.AsExpression or 318SyntaxKind.DefaultExpression or 319SyntaxKind.DefaultLiteralExpression or 320SyntaxKind.ConditionalExpression or 321SyntaxKind.ConditionalAccessExpression or 322SyntaxKind.PropertyDeclaration or 323SyntaxKind.VariableDeclarator;
src\roslyn\src\Analyzers\CSharp\CodeFixes\PopulateSwitch\CSharpPopulateSwitchExpressionCodeFixProvider.cs (1)
47insertLocation, newArms, SyntaxKind.CommaToken));
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveAsyncModifier\RemoveAsyncModifierHelpers.cs (1)
35var asyncTokenIndex = modifiers.IndexOf(SyntaxKind.AsyncKeyword);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (4)
67Debug.Assert(node.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression); 75n => n.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression);
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnnecessaryDiscardDesignation\CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs (1)
53SyntaxKind.IsExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnreachableCode\CSharpRemoveUnreachableCodeCodeFixProvider.cs (3)
81is not SyntaxKind.Block 82and not SyntaxKind.SwitchSection 83and not SyntaxKind.GlobalStatement)
src\roslyn\src\Analyzers\CSharp\CodeFixes\RemoveUnusedParametersAndValues\CSharpRemoveUnusedValuesCodeFixProvider.cs (12)
48case SyntaxKind.IdentifierName: 52case SyntaxKind.VariableDeclarator: 71case SyntaxKind.SingleVariableDesignation: 76case SyntaxKind.CatchDeclaration: 80case SyntaxKind.VarPattern: 81return node.IsParentKind(SyntaxKind.Subpattern) 93if (newNameNode.IsKind(SyntaxKind.DiscardDesignation)) 212if (originalCompoundAssignment.Parent.IsKind(SyntaxKind.ExpressionStatement)) 214if (!originalCompoundAssignment.IsKind(SyntaxKind.CoalesceAssignmentExpression)) 225BinaryExpression(SyntaxKind.CoalesceExpression, leftOfAssignment, rightOfAssignment)); 231var mappedBinaryExpressionKind = originalCompoundAssignment.Kind().MapCompoundAssignmentKindToBinaryExpressionKind(); 232if (mappedBinaryExpressionKind == SyntaxKind.None)
src\roslyn\src\Analyzers\CSharp\CodeFixes\ReplaceDefaultLiteral\CSharpReplaceDefaultLiteralCodeFixProvider.cs (2)
44token.IsKind(SyntaxKind.DefaultKeyword) && 45token.Parent is LiteralExpressionSyntax(SyntaxKind.DefaultLiteralExpression) defaultLiteral)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyInterpolation\CSharpSimplifyInterpolationCodeFixProvider.cs (1)
39if (interpolatedString.StringStartToken.Kind() == SyntaxKind.InterpolatedVerbatimStringStartToken)
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyAccessor\CSharpSimplifyPropertyAccessorCodeFixProvider.cs (1)
52containingProperty.Modifiers.Any(SyntaxKind.PartialKeyword) &&
src\roslyn\src\Analyzers\CSharp\CodeFixes\SimplifyPropertyPattern\CSharpSimplifyPropertyPatternCodeFixProvider.cs (1)
103return MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, outerExpression, innerName);
src\roslyn\src\Analyzers\CSharp\CodeFixes\TransposeRecordKeyword\CSharpTransposeRecordKeywordCodeFixProvider.cs (4)
45var skippedTriviaIndex = leadingTrivia.IndexOf(SyntaxKind.SkippedTokensTrivia); 54if (classOrStructKeyword.Kind() is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword) 60var trailingTriviaTakeUntil = remainingLeadingTrivia.IndexOf(SyntaxKind.EndOfLineTrivia) is >= 0 and var eolIndex
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (8)
51=> accessor.Kind() is SyntaxKind.SetAccessorDeclaration or SyntaxKind.InitAccessorDeclaration; 122var accessor = AccessorDeclaration(SyntaxKind.SetAccessorDeclaration).WithSemicolonToken(SemicolonToken); 129.WithModifiers(TokenList(updatedProperty.Modifiers.Where(token => !token.IsKind(SyntaxKind.ReadOnlyKeyword)))); 154var indentation = leadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia) whitespaceTrivia] 185=> attributeList.WithTarget(AttributeTargetSpecifier(Identifier(SyntaxFacts.GetText(SyntaxKind.FieldKeyword)), ColonToken.WithTrailingTrivia(Space))); 194AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) 203(isTrivialGetAccessor && accessor.Kind() is SyntaxKind.GetAccessorDeclaration) ||
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\SingleLinePropertyFormattingRule.cs (7)
16if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AccessorList)) 19if (previousToken.IsKind(SyntaxKind.OpenBraceToken) && previousToken.Parent.IsKind(SyntaxKind.AccessorList)) 22if (currentToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AccessorList)) 25if (previousToken.IsKind(SyntaxKind.SemicolonToken) && currentToken.Parent is AccessorDeclarationSyntax)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseAutoProperty\UseAutoPropertyRewriter.cs (2)
26if (node.Expression.IsKind(SyntaxKind.ThisExpression)) 47Parent: InitializerExpressionSyntax { RawKind: (int)SyntaxKind.ObjectInitializerExpression }
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (6)
103SyntaxKind.CollectionInitializerExpression, 105[LiteralExpression(SyntaxKind.NullLiteralExpression, NullKeyword.WithAdditionalAnnotations(nullTokenAnnotation))], 129if (nodesAndTokens.Count > 0 && nodesAndTokens.Last().GetTrailingTrivia() is [.., (kind: not SyntaxKind.EndOfLineTrivia)]) 549SyntaxKind.SimpleMemberAccessExpression, 674if (token.LeadingTrivia is not [.., (kind: SyntaxKind.WhitespaceTrivia)]) 925while (index - 1 >= 0 && trivia[index - 1].Kind() == SyntaxKind.WhitespaceTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider.cs (1)
23SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (2)
80if (addLineBreak && item.GetTrailingTrivia() is not [.., (kind: SyntaxKind.EndOfLineTrivia)]) 134SyntaxKind.ComplexElementInitializerExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundAssignmentCodeFixProvider.cs (11)
20: AbstractUseCompoundAssignmentCodeFixProvider<SyntaxKind, AssignmentExpressionSyntax, ExpressionSyntax>(Utilities.Kinds) 22protected override SyntaxToken Token(SyntaxKind kind) 26SyntaxKind assignmentOpKind, ExpressionSyntax left, SyntaxToken syntaxToken, ExpressionSyntax right) 33? Postfix(SyntaxKind.PostIncrementExpression, left) 34: Prefix(SyntaxKind.PreIncrementExpression, left); 38? Postfix(SyntaxKind.PostDecrementExpression, left) 39: Prefix(SyntaxKind.PreDecrementExpression, left); 41private static ExpressionSyntax Postfix(SyntaxKind kind, ExpressionSyntax operand) 44private static ExpressionSyntax Prefix(SyntaxKind kind, ExpressionSyntax operand) 47protected override SyntaxTriviaList PrepareRightExpressionLeadingTrivia(SyntaxTriviaList initialTrivia) => initialTrivia.SkipWhile(el => el.Kind() is SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia).ToSyntaxTriviaList();
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (2)
60SyntaxKind.CoalesceAssignmentExpression, 107SyntaxKind.CoalesceAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseConditionalExpression\MultiLineConditionalExpressionFormattingRule.cs (2)
34=> token.Kind() is SyntaxKind.QuestionToken or SyntaxKind.ColonToken && token.GetRequiredParent().HasAnnotation(SpecializedFormattingAnnotation);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDeconstruction\CSharpUseDeconstructionCodeFixProvider.cs (1)
138SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseDefaultLiteral\CSharpUseDefaultLiteralCodeFixProvider.cs (1)
59SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression).WithTriviaFrom(defaultExpression)),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (3)
134a => a.Expression.Kind() != SyntaxKind.DefaultLiteralExpression && Equals(arrayElementType, semanticModel.GetTypeInfo(a.Expression).Type)); 152SyntaxKind.SimpleMemberAccessExpression, 166SyntaxKind.ArrayInitializerExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (4)
200case SyntaxKind.SingleVariableDesignation: 206case SyntaxKind.DiscardDesignation: 210case SyntaxKind.ParenthesizedVariableDesignation: 225var separatorBuilder = ArrayBuilder<SyntaxToken>.GetInstance(builder.Count - 1, Token(leading: default, SyntaxKind.CommaToken, trailing: default));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\Helpers.cs (1)
17SyntaxKind.IndexExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseInterpolatedVerbatimString\CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (1)
54var newStartToken = SyntaxFactory.Token(oldStartToken.LeadingTrivia, SyntaxKind.InterpolatedVerbatimStringStartToken,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs (3)
68if (binary.IsKind(SyntaxKind.EqualsExpression)) 81SyntaxKind.IsExpression, 88=> binary.Right.IsKind(SyntaxKind.NullLiteralExpression)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseIsNullCheckForReferenceEqualsCodeFixProvider.cs (3)
25= LiteralExpression(SyntaxKind.NullLiteralExpression); 34=> BinaryExpression(SyntaxKind.EqualsExpression, argument, s_nullLiteralExpression).Parenthesize(); 52SyntaxKind.IsExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs (1)
26private static readonly ConstantPatternSyntax s_nullConstantPattern = ConstantPattern(LiteralExpression(SyntaxKind.NullLiteralExpression));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseLocalFunction\CSharpUseLocalFunctionCodeFixProvider.cs (1)
212if (anonymousFunction.AsyncKeyword.IsKind(SyntaxKind.AsyncKeyword))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseNullPropagation\CSharpUseNullPropagationCodeFixProvider.cs (1)
21SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\CSharpUseObjectInitializerCodeFixProvider.cs (1)
29SyntaxKind,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseObjectInitializer\UseInitializerHelpers.cs (3)
28var initializerKind = firstExpression is AssignmentExpressionSyntax 29? SyntaxKind.ObjectInitializerExpression 30: SyntaxKind.CollectionInitializerExpression;
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternCombinators\CSharpUsePatternCombinatorsCodeFixProvider.cs (12)
36private static SyntaxKind MapToSyntaxKind(BinaryOperatorKind kind) 40BinaryOperatorKind.LessThan => SyntaxKind.LessThanToken, 41BinaryOperatorKind.GreaterThan => SyntaxKind.GreaterThanToken, 42BinaryOperatorKind.LessThanOrEqual => SyntaxKind.LessThanEqualsToken, 43BinaryOperatorKind.GreaterThanOrEqual => SyntaxKind.GreaterThanEqualsToken, 93p.IsDisjunctive ? SyntaxKind.OrPattern : SyntaxKind.AndPattern, 95Token(p.Token.LeadingTrivia, p.IsDisjunctive ? SyntaxKind.OrKeyword : SyntaxKind.AndKeyword, 115if (unwrapped is UnaryPatternSyntax(SyntaxKind.NotPattern) unaryPattern) 129if (expr.IsKind(SyntaxKind.DefaultLiteralExpression)) 133if (expr.IsKind(SyntaxKind.NullLiteralExpression))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (7)
123if (isPatternExpression.Pattern is UnaryPatternSyntax(kind: SyntaxKind.NotPattern) unaryPattern && 137SyntaxKind.EqualsExpression => ConstantPattern(binaryExpression.Right), 139SyntaxKind.NotEqualsExpression => UnaryPattern(ConstantPattern(binaryExpression.Right)), 142SyntaxKind.GreaterThanExpression or 143SyntaxKind.GreaterThanOrEqualExpression or 144SyntaxKind.LessThanExpression or 145SyntaxKind.LessThanOrEqualExpression => RelationalPattern(binaryExpression.OperatorToken, binaryExpression.Right),
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndNullCheckCodeFixProvider.cs (3)
168if (comparison.Kind() is not (SyntaxKind.EqualsExpression or SyntaxKind.IsPatternExpression)) 179return PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, isPatternExpression.Parenthesize());
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpIsAndCastCheckCodeFixProvider.cs (1)
88newIf = originalIf.IsParentKind(SyntaxKind.ElseClause)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (7)
42Matcher.Single<SyntaxTrivia>(t => t.Kind() == SyntaxKind.EndOfLineTrivia, "first end of line"), 43Matcher.Repeat(Matcher.Single<SyntaxTrivia>(t => t.Kind() == SyntaxKind.WhitespaceTrivia, "whitespace")), 44Matcher.Single<SyntaxTrivia>(t => t.IsKind(SyntaxKind.EndOfLineTrivia), "second end of line")); 265var inKeyword = current.Modifiers.FirstOrDefault(t => t.Kind() == SyntaxKind.InKeyword); 334: MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, containingTypeSyntax, currentName); 374=> node.GetLeadingTrivia() is [.., (kind: SyntaxKind.WhitespaceTrivia) whitespace] ? whitespace.ToString() : ""; 550=> memberDeclaration.GetLeadingTrivia().Any(t => t.GetStructure()?.Kind() == SyntaxKind.PragmaWarningDirectiveTrivia)
src\roslyn\src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs (3)
132var insertionIndex = leadingTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)] 159SyntaxKind.SingleLineDocumentationCommentTrivia, 220Trivia(DocumentationCommentTrivia(SyntaxKind.SingleLineDocumentationCommentTrivia, [.. allContent])));
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseSimpleUsingStatement\UseSimpleUsingStatementCodeFixProvider.cs (1)
147.Any(SyntaxKind.EndOfLineTrivia);
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseTupleSwap\CSharpUseTupleSwapCodeFixProvider.cs (1)
59SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUnboundGenericTypeInNameOf\CSharpUseUnboundGenericTypeInNameOfCodeFixProvider.cs (1)
63if (current.Arguments.Any(a => a.Kind() != SyntaxKind.OmittedTypeArgument))
src\roslyn\src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (3)
161if (argument.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken) 202SyntaxKind.SimpleMemberAccessExpression,
src\roslyn\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (38)
74case SyntaxKind.NamespaceDeclaration: 75case SyntaxKind.FileScopedNamespaceDeclaration: 88while (name.Kind() == SyntaxKind.QualifiedName) 98case SyntaxKind.ClassDeclaration: 99case SyntaxKind.StructDeclaration: 100case SyntaxKind.RecordDeclaration: 101case SyntaxKind.RecordStructDeclaration: 121goto case SyntaxKind.InterfaceDeclaration; 123case SyntaxKind.InterfaceDeclaration: 124case SyntaxKind.ExtensionBlockDeclaration: 142case SyntaxKind.EnumDeclaration: 158case SyntaxKind.EnumMemberDeclaration: 170case SyntaxKind.DelegateDeclaration: 184case SyntaxKind.EventDeclaration: 202case SyntaxKind.EventFieldDeclaration: 203case SyntaxKind.FieldDeclaration: 222case SyntaxKind.ArrowExpressionClause: 233case SyntaxKind.PropertyDeclaration: 258case SyntaxKind.IndexerDeclaration: 284case SyntaxKind.AddAccessorDeclaration: 285case SyntaxKind.RemoveAccessorDeclaration: 286case SyntaxKind.GetAccessorDeclaration: 287case SyntaxKind.SetAccessorDeclaration: 288case SyntaxKind.InitAccessorDeclaration: 301case SyntaxKind.ConstructorDeclaration: 302case SyntaxKind.ConversionOperatorDeclaration: 303case SyntaxKind.DestructorDeclaration: 304case SyntaxKind.MethodDeclaration: 305case SyntaxKind.OperatorDeclaration: 336case SyntaxKind.CompilationUnit: 438case SyntaxKind.ArrowExpressionClause: 441case SyntaxKind.MethodDeclaration: 444case SyntaxKind.OperatorDeclaration: 447case SyntaxKind.ConversionOperatorDeclaration: 450case SyntaxKind.PropertyDeclaration: 453case SyntaxKind.IndexerDeclaration: 456case SyntaxKind.ConstructorDeclaration: 459case SyntaxKind.DestructorDeclaration:
src\roslyn\src\Compilers\CSharp\Portable\Syntax\LambdaUtilities.cs (90)
24case SyntaxKind.ParenthesizedLambdaExpression: 25case SyntaxKind.SimpleLambdaExpression: 26case SyntaxKind.AnonymousMethodExpression: 27case SyntaxKind.LetClause: 28case SyntaxKind.WhereClause: 29case SyntaxKind.AscendingOrdering: 30case SyntaxKind.DescendingOrdering: 31case SyntaxKind.JoinClause: 32case SyntaxKind.GroupClause: 33case SyntaxKind.LocalFunctionStatement: 36case SyntaxKind.SelectClause: 40case SyntaxKind.FromClause: 42return !node.Parent.IsKind(SyntaxKind.QueryExpression); 57if (lambda.IsKind(SyntaxKind.ArrowExpressionClause)) 63Debug.Assert(lambda.IsKind(SyntaxKind.LocalFunctionStatement)); 79case SyntaxKind.ParenthesizedLambdaExpression: 80case SyntaxKind.SimpleLambdaExpression: 81case SyntaxKind.AnonymousMethodExpression: 84case SyntaxKind.FromClause: 87case SyntaxKind.LetClause: 90case SyntaxKind.WhereClause: 93case SyntaxKind.AscendingOrdering: 94case SyntaxKind.DescendingOrdering: 97case SyntaxKind.SelectClause: 104case SyntaxKind.JoinClause: 110case SyntaxKind.GroupClause: 117case SyntaxKind.LocalFunctionStatement: 151case SyntaxKind.ParenthesizedLambdaExpression: 152case SyntaxKind.SimpleLambdaExpression: 153case SyntaxKind.AnonymousMethodExpression: 157case SyntaxKind.LocalFunctionStatement: 161case SyntaxKind.ArrowExpressionClause: 165case SyntaxKind.FromClause: 169case SyntaxKind.JoinClause: 173case SyntaxKind.LetClause: 177case SyntaxKind.WhereClause: 181case SyntaxKind.AscendingOrdering: 182case SyntaxKind.DescendingOrdering: 186case SyntaxKind.SelectClause: 190case SyntaxKind.GroupClause: 220if (!selectOrGroupExpression.IsKind(SyntaxKind.IdentifierName)) 232if (containingQueryOrContinuation.IsKind(SyntaxKind.QueryExpression)) 250if (selectOrGroupClause.IsKind(SyntaxKind.SelectClause) && containingBody.Clauses.Count == 0) 257if (!clause.IsKind(SyntaxKind.WhereClause) && !clause.IsKind(SyntaxKind.OrderByClause)) 292case SyntaxKind.ParenthesizedLambdaExpression: 293case SyntaxKind.SimpleLambdaExpression: 294case SyntaxKind.AnonymousMethodExpression: 298case SyntaxKind.FromClause: 300if (node.Parent.IsKind(SyntaxKind.QueryExpression)) 308case SyntaxKind.JoinClause: 314case SyntaxKind.LetClause: 318case SyntaxKind.WhereClause: 322case SyntaxKind.AscendingOrdering: 323case SyntaxKind.DescendingOrdering: 327case SyntaxKind.SelectClause: 337case SyntaxKind.GroupClause: 351case SyntaxKind.LocalFunctionStatement: 378return syntax.IsKind(SyntaxKind.GroupClause) || 379syntax.IsKind(SyntaxKind.JoinClause) || 380syntax.IsKind(SyntaxKind.FromClause); 392case SyntaxKind.CompilationUnit: 393case SyntaxKind.Block: 394case SyntaxKind.SwitchStatement: 395case SyntaxKind.ArrowExpressionClause: // expression-bodied member 396case SyntaxKind.CatchClause: 397case SyntaxKind.ForStatement: 398case SyntaxKind.ForEachStatement: 399case SyntaxKind.ForEachVariableStatement: 400case SyntaxKind.UsingStatement: 401case SyntaxKind.TryStatement: 404case SyntaxKind.ConstructorDeclaration: 408case SyntaxKind.DoStatement: 409case SyntaxKind.ExpressionStatement: 410case SyntaxKind.FixedStatement: 411case SyntaxKind.GotoCaseStatement: 412case SyntaxKind.IfStatement: 413case SyntaxKind.LockStatement: 414case SyntaxKind.ReturnStatement: 415case SyntaxKind.ThrowStatement: 416case SyntaxKind.WhileStatement: 417case SyntaxKind.YieldReturnStatement: 420case SyntaxKind.ClassDeclaration: 421case SyntaxKind.StructDeclaration: 422case SyntaxKind.RecordDeclaration: 423case SyntaxKind.RecordStructDeclaration: 432case SyntaxKind.SwitchExpression: 433case SyntaxKind.AwaitExpression: 446case SyntaxKind.EqualsValueClause: 449case SyntaxKind.ForStatement:
src\roslyn\src\Compilers\CSharp\Portable\Syntax\SyntaxBindingUtilities.cs (2)
14=> node.IsKind(SyntaxKind.YieldReturnStatement) || 15node.IsKind(SyntaxKind.AwaitExpression) ||
StringIndentation\CSharpStringIndentationService.cs (3)
43StringStartToken.RawKind: (int)SyntaxKind.InterpolatedMultiLineRawStringStartToken 67if (child.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken)
Structure\CSharpBlockStructureProvider.cs (2)
66builder.Add((int)SyntaxKind.DisabledTextTrivia, [new DisabledTextTriviaStructureProvider()]); 67builder.Add((int)SyntaxKind.MultiLineCommentTrivia, [new MultilineCommentBlockStructureProvider()]);
Structure\CSharpStructureHelpers.cs (13)
66if (trivia.IsKind(SyntaxKind.EndOfLineTrivia)) 73else if (!trivia.IsKind(SyntaxKind.WhitespaceTrivia)) 86if (lastToken.Kind() == SyntaxKind.None) 94if (nextToken.Kind() is not SyntaxKind.None and SyntaxKind.SemicolonToken) 187SyntaxKind.WhitespaceTrivia or SyntaxKind.EndOfLineTrivia or SyntaxKind.EndOfFileToken)) 236if (startToken.IsKind(SyntaxKind.None) || endToken.IsKind(SyntaxKind.None)) 243var firstComment = startToken.LeadingTrivia.FirstOrNull(t => t.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia); 380if (child.Kind() != SyntaxKind.AttributeList)
Structure\Providers\AnonymousMethodExpressionStructureProvider.cs (1)
30if (lastToken.Kind() == SyntaxKind.None)
Structure\Providers\ArrowExpressionClauseStructureProvider.cs (1)
32autoCollapse: parent.Kind() != SyntaxKind.LocalFunctionStatement));
Structure\Providers\BlockSyntaxStructureProvider.cs (28)
29var parentKind = parent.Kind(); 91else if (parentKind == SyntaxKind.ElseClause || IsNonBlockStatement(parent)) 97if (parentKind == SyntaxKind.LocalFunctionStatement) 101parent.IsParentKind(SyntaxKind.GlobalStatement); 134if (parentKind is SyntaxKind.Block or SyntaxKind.SwitchSection) 152=> node is StatementSyntax(kind: not SyntaxKind.Block); 157if (parent.IsKind(SyntaxKind.IfStatement) && parent.IsParentKind(SyntaxKind.ElseClause)) 170if (previousToken.IsKind(SyntaxKind.None)) 180if (node.Parent.IsKind(SyntaxKind.IfStatement)) 206SyntaxKind.ForStatement => BlockTypes.Loop, 207SyntaxKind.ForEachStatement => BlockTypes.Loop, 208SyntaxKind.ForEachVariableStatement => BlockTypes.Loop, 209SyntaxKind.WhileStatement => BlockTypes.Loop, 210SyntaxKind.DoStatement => BlockTypes.Loop, 211SyntaxKind.TryStatement => BlockTypes.Statement, 212SyntaxKind.CatchClause => BlockTypes.Statement, 213SyntaxKind.FinallyClause => BlockTypes.Statement, 214SyntaxKind.UnsafeStatement => BlockTypes.Statement, 215SyntaxKind.FixedStatement => BlockTypes.Statement, 216SyntaxKind.LockStatement => BlockTypes.Statement, 217SyntaxKind.UsingStatement => BlockTypes.Statement, 218SyntaxKind.IfStatement => BlockTypes.Conditional, 219SyntaxKind.ElseClause => BlockTypes.Conditional, 220SyntaxKind.SwitchSection => BlockTypes.Conditional, 221SyntaxKind.Block => BlockTypes.Statement, 222SyntaxKind.LocalFunctionStatement => BlockTypes.Statement,
Structure\Providers\CollectionExpressionStructureProvider.cs (1)
38var end = nextToken.Kind() == SyntaxKind.CommaToken
Structure\Providers\ConstructorDeclarationStructureProvider.cs (1)
38&& (!nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.ConstructorDeclaration));
Structure\Providers\ConversionOperatorDeclarationStructureProvider.cs (1)
40&& (!nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.ConversionOperatorDeclaration));
Structure\Providers\DisabledTextTriviaStructureProvider.cs (7)
48if (!parentTriviaList[indexInParent - 1].IsKind(SyntaxKind.IfDirectiveTrivia) && 49!parentTriviaList[indexInParent - 1].IsKind(SyntaxKind.ElifDirectiveTrivia) && 50!parentTriviaList[indexInParent - 1].IsKind(SyntaxKind.ElseDirectiveTrivia)) 93case SyntaxKind.IfDirectiveTrivia: 99case SyntaxKind.EndIfDirectiveTrivia: 112case SyntaxKind.ElseDirectiveTrivia: 113case SyntaxKind.ElifDirectiveTrivia:
Structure\Providers\EventDeclarationStructureProvider.cs (2)
39&& (!nextSibling.IsNode || nextSibling.Kind() is SyntaxKind.EventDeclaration or SyntaxKind.EventFieldDeclaration);
Structure\Providers\IndexerDeclarationStructureProvider.cs (2)
39&& (!nextSibling.IsNode || nextSibling.Kind() is SyntaxKind.IndexerDeclaration or SyntaxKind.PropertyDeclaration);
Structure\Providers\InitializerExpressionStructureProvider.cs (1)
40var end = nextToken.Kind() == SyntaxKind.CommaToken
Structure\Providers\MethodDeclarationStructureProvider.cs (1)
38&& (!nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.MethodDeclaration));
Structure\Providers\OperatorDeclarationStructureProvider.cs (1)
38&& (!nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.OperatorDeclaration));
Structure\Providers\ParenthesizedLambdaExpressionStructureProvider.cs (1)
35if (lastToken.Kind() == SyntaxKind.None)
Structure\Providers\PropertyDeclarationStructureProvider.cs (2)
38&& (!nextSibling.IsNode || nextSibling.Kind() is SyntaxKind.PropertyDeclaration or SyntaxKind.IndexerDeclaration);
Structure\Providers\SimpleLambdaExpressionStructureProvider.cs (1)
35if (lastToken.Kind() == SyntaxKind.None)
Structure\Providers\StringLiteralExpressionStructureProvider.cs (3)
21if (node.IsKind(SyntaxKind.StringLiteralExpression) && !node.ContainsDiagnostics) 43if (node.Token.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken)
SyncedSource\FileBasedPrograms\FileLevelDirectiveHelpers.cs (8)
69while (!result.Token.IsKind(SyntaxKind.EndOfFileToken)); 74if (trivia.ContainsDiagnostics && trivia.IsKind(SyntaxKind.IgnoredDirectiveTrivia)) 104if (trivia.IsKind(SyntaxKind.WhitespaceTrivia)) 111if (trivia.IsKind(SyntaxKind.ShebangDirectiveTrivia)) 125else if (trivia.IsKind(SyntaxKind.IgnoredDirectiveTrivia)) 129var message = trivia.GetStructure() is IgnoredDirectiveTriviaSyntax { Content: { RawKind: (int)SyntaxKind.StringLiteralToken } content } 205if (trivia.IsKind(SyntaxKind.EndOfLineTrivia)) 212if (trivia.IsKind(SyntaxKind.WhitespaceTrivia))
SyncNamespaces\CSharpSyncNamespacesService.cs (2)
22CSharpChangeNamespaceToMatchFolderCodeFixProvider codeFixProvider) : AbstractSyncNamespacesService<SyntaxKind, BaseNamespaceDeclarationSyntax> 24public override AbstractMatchFolderAndNamespaceDiagnosticAnalyzer<SyntaxKind, BaseNamespaceDeclarationSyntax> DiagnosticAnalyzer { get; } = diagnosticAnalyzer;
TaskList\CSharpTaskListService.cs (1)
84return trivia.Kind() != SyntaxKind.RegionDirectiveTrivia &&
UsePatternMatching\CSharpIsAndCastCheckWithoutNameDiagnosticAnalyzer.cs (3)
57context.RegisterSyntaxNodeAction(context => SyntaxNodeAction(context, expressionType), SyntaxKind.IsExpression); 184if (node is LocalFunctionStatementSyntax localFunction && localFunction.Modifiers.Any(SyntaxKind.StaticKeyword)) 187if (node is AnonymousFunctionExpressionSyntax anonymousFunction && anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword))
Wrapping\SeparatedSyntaxList\CSharpParameterWrapper.cs (1)
54if (declaration.Kind() == SyntaxKind.SimpleLambdaExpression)
Microsoft.CodeAnalysis.CSharp.NetAnalyzers (134)
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 (5)
63if (root.GetLeadingTrivia().Any(SyntaxKind.ShebangDirectiveTrivia)) 113case SyntaxKind.SingleLineCommentTrivia: 114case SyntaxKind.MultiLineCommentTrivia: 121case SyntaxKind.WhitespaceTrivia: 122case SyntaxKind.EndOfLineTrivia:
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler.CSharp\Extensions\SyntaxGeneratorExtensions.cs (5)
18public static SyntaxNode CreateBinaryExpression(this SyntaxGenerator generator, SyntaxKind syntaxKind, SyntaxNode left, SyntaxNode right) 22=> generator.CreateBinaryExpression(SyntaxKind.ExclusiveOrExpression, left, right); 25=> generator.CreateBinaryExpression(SyntaxKind.LeftShiftExpression, left, right); 28=> generator.CreateBinaryExpression(SyntaxKind.RightShiftExpression, left, right); 34if (!Enum.IsDefined(typeof(SyntaxKind), SyntaxKindEx.UnsignedRightShiftExpression))
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler.CSharp\Extensions\SyntaxNodeExtensions.cs (7)
19while (current.IsKind(SyntaxKind.ParenthesizedExpression) && current.ChildNodes().FirstOrDefault() is SyntaxNode expression) 39if (expression.IsKind(SyntaxKind.RefExpression)) 53if (expression.IsKind(SyntaxKind.ThrowExpression)) 71SyntaxFactory.Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 73SyntaxFactory.Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty)); 85SyntaxFactory.Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 87SyntaxFactory.Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler.CSharp\Lightup\SyntaxKindEx.cs (10)
11public const SyntaxKind Utf8StringLiteralToken = (SyntaxKind)8520; 12public const SyntaxKind UnsignedRightShiftExpression = (SyntaxKind)8692; 13public const SyntaxKind Utf8StringLiteralExpression = (SyntaxKind)8756; 14public const SyntaxKind CollectionExpression = (SyntaxKind)9076; 15public const SyntaxKind ExtensionBlockDeclaration = (SyntaxKind)9079;
Microsoft.CodeAnalysis.CSharp.Workspaces (3868)
Classification\ClassificationHelpers.cs (147)
36else if (SyntaxFacts.IsKeywordKind(token.Kind()) || token.IsKind(SyntaxKind.DiscardDesignation)) 45else if (token.Kind() == SyntaxKind.IdentifierToken) 55else if (token.Kind() == SyntaxKind.NumericLiteralToken) 68public static bool IsControlKeywordKind(SyntaxKind kind) 72case SyntaxKind.AwaitKeyword: 73case SyntaxKind.BreakKeyword: 74case SyntaxKind.CaseKeyword: 75case SyntaxKind.CatchKeyword: 76case SyntaxKind.ContinueKeyword: 77case SyntaxKind.DefaultKeyword: // Include DefaultKeyword as it can be part of a DefaultSwitchLabel 78case SyntaxKind.DoKeyword: 79case SyntaxKind.ElseKeyword: 80case SyntaxKind.FinallyKeyword: 81case SyntaxKind.ForEachKeyword: 82case SyntaxKind.ForKeyword: 83case SyntaxKind.GotoKeyword: 84case SyntaxKind.IfKeyword: 85case SyntaxKind.InKeyword: // Include InKeyword as it can be part of an ForEachStatement 86case SyntaxKind.ReturnKeyword: 87case SyntaxKind.SwitchKeyword: 88case SyntaxKind.ThrowKeyword: 89case SyntaxKind.TryKeyword: 90case SyntaxKind.WhenKeyword: // Include WhenKeyword as it can be part of a CatchFilterClause or a pattern WhenClause 91case SyntaxKind.WhileKeyword: 92case SyntaxKind.YieldKeyword: 99public static bool IsControlStatementKind(SyntaxKind kind) 104case SyntaxKind.BreakStatement: 105case SyntaxKind.ContinueStatement: 106case SyntaxKind.DoStatement: 107case SyntaxKind.ForEachStatement: 108case SyntaxKind.ForEachVariableStatement: 109case SyntaxKind.ForStatement: 110case SyntaxKind.GotoCaseStatement: 111case SyntaxKind.GotoDefaultStatement: 112case SyntaxKind.GotoStatement: 113case SyntaxKind.ReturnStatement: 114case SyntaxKind.ThrowStatement: 115case SyntaxKind.WhileStatement: 116case SyntaxKind.YieldBreakStatement: 117case SyntaxKind.YieldReturnStatement: 119case SyntaxKind.AwaitExpression: 120case SyntaxKind.CasePatternSwitchLabel: 121case SyntaxKind.CaseSwitchLabel: 122case SyntaxKind.CatchClause: 123case SyntaxKind.CatchFilterClause: 124case SyntaxKind.DefaultSwitchLabel: 125case SyntaxKind.ElseClause: 126case SyntaxKind.FinallyClause: 127case SyntaxKind.IfStatement: 128case SyntaxKind.SwitchExpression: 129case SyntaxKind.SwitchSection: 130case SyntaxKind.SwitchStatement: 131case SyntaxKind.ThrowExpression: 132case SyntaxKind.TryStatement: 133case SyntaxKind.WhenClause: 143is SyntaxKind.StringLiteralToken 144or SyntaxKind.Utf8StringLiteralToken 145or SyntaxKind.CharacterLiteralToken 146or SyntaxKind.InterpolatedStringStartToken 147or SyntaxKind.InterpolatedVerbatimStringStartToken 148or SyntaxKind.InterpolatedStringTextToken 149or SyntaxKind.InterpolatedStringEndToken 150or SyntaxKind.InterpolatedRawStringEndToken 151or SyntaxKind.InterpolatedSingleLineRawStringStartToken 152or SyntaxKind.InterpolatedMultiLineRawStringStartToken 153or SyntaxKind.SingleLineRawStringLiteralToken 154or SyntaxKind.Utf8SingleLineRawStringLiteralToken 155or SyntaxKind.MultiLineRawStringLiteralToken 156or SyntaxKind.Utf8MultiLineRawStringLiteralToken; 168case SyntaxKind.InterpolatedVerbatimStringStartToken: 170case SyntaxKind.InterpolatedStringStartToken: 173case SyntaxKind.InterpolatedStringEndToken: 176&& interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken); 179case SyntaxKind.InterpolatedStringTextToken: 187&& interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken); 210if (methodDeclaration.ParameterList.Parameters is [var parameter, ..] && parameter.Modifiers.Any(SyntaxKind.ThisKeyword)) 247FieldDeclarationSyntax fieldDeclaration => fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword) ? ClassificationTypeNames.ConstantName : ClassificationTypeNames.FieldName, 294SyntaxKind.ClassDeclaration => ClassificationTypeNames.ClassName, 295SyntaxKind.InterfaceDeclaration => ClassificationTypeNames.InterfaceName, 296SyntaxKind.RecordDeclaration => ClassificationTypeNames.RecordClassName, 297SyntaxKind.RecordStructDeclaration => ClassificationTypeNames.RecordStructName, 298SyntaxKind.StructDeclaration => ClassificationTypeNames.StructName, 301SyntaxKind.UnionDeclaration => ClassificationTypeNames.StructName, 319if (parentNode.IsKind(SyntaxKind.EnumMemberDeclaration)) 326else if (parentNode.IsKind(SyntaxKind.VariableDeclarator)) 333if (parentNode.GetModifiers().Any(SyntaxKind.ConstKeyword)) 339return parentNode.GetModifiers().Any(SyntaxKind.StaticKeyword); 345SyntaxKind.ClassDeclaration => ClassificationTypeNames.ClassName, 346SyntaxKind.EnumDeclaration => ClassificationTypeNames.EnumName, 347SyntaxKind.StructDeclaration => ClassificationTypeNames.StructName, 348SyntaxKind.UnionDeclaration => ClassificationTypeNames.StructName, 349SyntaxKind.InterfaceDeclaration => ClassificationTypeNames.InterfaceName, 350SyntaxKind.RecordDeclaration => ClassificationTypeNames.RecordClassName, 351SyntaxKind.RecordStructDeclaration => ClassificationTypeNames.RecordStructName, 362case SyntaxKind.LessThanToken: 363case SyntaxKind.GreaterThanToken: 368if (token.Parent.Kind() is SyntaxKind.TypeParameterList or 369SyntaxKind.TypeArgumentList or 370SyntaxKind.FunctionPointerParameterList) 377case SyntaxKind.ColonToken: 382if (token.Parent.Kind() != SyntaxKind.ConditionalExpression) 399private static bool IsOperator(this SyntaxKind kind) 403case SyntaxKind.TildeToken: 404case SyntaxKind.ExclamationToken: 405case SyntaxKind.PercentToken: 406case SyntaxKind.CaretToken: 407case SyntaxKind.AmpersandToken: 408case SyntaxKind.AsteriskToken: 409case SyntaxKind.MinusToken: 410case SyntaxKind.PlusToken: 411case SyntaxKind.EqualsToken: 412case SyntaxKind.BarToken: 413case SyntaxKind.ColonToken: 414case SyntaxKind.LessThanToken: 415case SyntaxKind.GreaterThanToken: 416case SyntaxKind.DotToken: 417case SyntaxKind.QuestionToken: 418case SyntaxKind.SlashToken: 419case SyntaxKind.BarBarToken: 420case SyntaxKind.AmpersandAmpersandToken: 421case SyntaxKind.MinusMinusToken: 422case SyntaxKind.PlusPlusToken: 423case SyntaxKind.ColonColonToken: 424case SyntaxKind.QuestionQuestionToken: 425case SyntaxKind.MinusGreaterThanToken: 426case SyntaxKind.ExclamationEqualsToken: 427case SyntaxKind.EqualsEqualsToken: 428case SyntaxKind.EqualsGreaterThanToken: 429case SyntaxKind.LessThanEqualsToken: 430case SyntaxKind.LessThanLessThanToken: 431case SyntaxKind.LessThanLessThanEqualsToken: 432case SyntaxKind.GreaterThanEqualsToken: 433case SyntaxKind.GreaterThanGreaterThanToken: 434case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 435case SyntaxKind.GreaterThanGreaterThanEqualsToken: 436case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 437case SyntaxKind.SlashEqualsToken: 438case SyntaxKind.AsteriskEqualsToken: 439case SyntaxKind.BarEqualsToken: 440case SyntaxKind.AmpersandEqualsToken: 441case SyntaxKind.PlusEqualsToken: 442case SyntaxKind.MinusEqualsToken: 443case SyntaxKind.CaretEqualsToken: 444case SyntaxKind.PercentEqualsToken: 445case SyntaxKind.QuestionQuestionEqualsToken: 549|| (wasKeyword && SyntaxFacts.GetContextualKeywordKind(text) != SyntaxKind.None) 552var isIdentifier = token.Kind() == SyntaxKind.IdentifierToken;
Classification\SyntaxClassification\DiscardSyntaxClassifier.cs (2)
28if (syntax.Kind() is SyntaxKind.DiscardDesignation or SyntaxKind.DiscardPattern)
Classification\SyntaxClassification\DocCommentCodeBlockClassifier.cs (4)
89else if (current.Kind() is SyntaxKind.XmlEntityLiteralToken or SyntaxKind.XmlTextLiteralToken or SyntaxKind.XmlTextLiteralNewLineToken) 179if (token.Kind() == SyntaxKind.XmlEntityLiteralToken)
Classification\SyntaxClassification\NameSyntaxClassifier.cs (4)
42=> node.IsParentKind(SyntaxKind.Attribute); 137name.Identifier.IsKind(SyntaxKind.GlobalKeyword); 173if ((name.IsUnmanaged || name.IsNotNull) && name.Parent.IsKind(SyntaxKind.TypeConstraint)) 291name.Identifier.HasMatchingText(SyntaxKind.FromKeyword) &&
Classification\SyntaxClassification\OperatorOverloadSyntaxClassifier.cs (1)
35if (syntax.IsKind(SyntaxKind.SimpleAssignmentExpression))
Classification\SyntaxClassification\SyntaxTokenClassifier.cs (3)
22public override ImmutableArray<int> SyntaxTokenKinds { get; } = [(int)SyntaxKind.LessThanToken]; 68if (identifierName.IsParentKind(SyntaxKind.MemberBindingExpression)) 78if (identifier.Parent.IsParentKind(SyntaxKind.ConditionalAccessExpression))
Classification\Worker.cs (34)
128SyntaxKind.Utf8StringLiteralToken or 129SyntaxKind.Utf8SingleLineRawStringLiteralToken or 130SyntaxKind.Utf8MultiLineRawStringLiteralToken && 142if (token.Kind() == SyntaxKind.IdentifierToken && 207case SyntaxKind.SingleLineCommentTrivia: 208case SyntaxKind.MultiLineCommentTrivia: 209case SyntaxKind.ShebangDirectiveTrivia: 213case SyntaxKind.DisabledTextTrivia: 217case SyntaxKind.SkippedTokensTrivia: 221case SyntaxKind.SingleLineDocumentationCommentTrivia: 222case SyntaxKind.MultiLineDocumentationCommentTrivia: 226case SyntaxKind.DocumentationCommentExteriorTrivia: 230case SyntaxKind.ConflictMarkerTrivia: 234case SyntaxKind.IfDirectiveTrivia: 235case SyntaxKind.ElifDirectiveTrivia: 236case SyntaxKind.ElseDirectiveTrivia: 237case SyntaxKind.EndIfDirectiveTrivia: 238case SyntaxKind.RegionDirectiveTrivia: 239case SyntaxKind.EndRegionDirectiveTrivia: 240case SyntaxKind.DefineDirectiveTrivia: 241case SyntaxKind.UndefDirectiveTrivia: 242case SyntaxKind.ErrorDirectiveTrivia: 243case SyntaxKind.WarningDirectiveTrivia: 244case SyntaxKind.LineDirectiveTrivia: 245case SyntaxKind.LineSpanDirectiveTrivia: 246case SyntaxKind.PragmaWarningDirectiveTrivia: 247case SyntaxKind.PragmaChecksumDirectiveTrivia: 248case SyntaxKind.ReferenceDirectiveTrivia: 249case SyntaxKind.LoadDirectiveTrivia: 250case SyntaxKind.IgnoredDirectiveTrivia: 251case SyntaxKind.NullableDirectiveTrivia: 252case SyntaxKind.BadDirectiveTrivia: 279triviaList[index - 1].Kind() == SyntaxKind.EndOfLineTrivia && 280triviaList[index - 2].Kind() == SyntaxKind.ConflictMarkerTrivia)
Classification\Worker_DocumentationComments.cs (21)
45case SyntaxKind.XmlElement: 48case SyntaxKind.XmlEmptyElement: 51case SyntaxKind.XmlText: 54case SyntaxKind.XmlComment: 57case SyntaxKind.XmlCDataSection: 60case SyntaxKind.XmlProcessingInstruction: 72case SyntaxKind.DocumentationCommentExteriorTrivia: 76case SyntaxKind.SkippedTokensTrivia: 159if (token.Kind() == SyntaxKind.XmlEntityLiteralToken) 163else if (token.Kind() != SyntaxKind.XmlTextLiteralNewLineToken) 168case SyntaxKind.XmlText: 171case SyntaxKind.XmlTextAttribute: 174case SyntaxKind.XmlComment: 177case SyntaxKind.XmlCDataSection: 180case SyntaxKind.XmlProcessingInstruction: 262case SyntaxKind.XmlTextAttribute: 271case SyntaxKind.XmlCrefAttribute: 274case SyntaxKind.XmlNameAttribute: 309var kind = SyntaxFacts.GetKeywordKind(token.Text); 310if (kind is SyntaxKind.None) 313if (kind is SyntaxKind.None)
Classification\Worker_Preprocesser.cs (25)
23case SyntaxKind.IfDirectiveTrivia: 26case SyntaxKind.ElifDirectiveTrivia: 29case SyntaxKind.ElseDirectiveTrivia: 32case SyntaxKind.EndIfDirectiveTrivia: 35case SyntaxKind.RegionDirectiveTrivia: 38case SyntaxKind.EndRegionDirectiveTrivia: 41case SyntaxKind.ErrorDirectiveTrivia: 44case SyntaxKind.WarningDirectiveTrivia: 47case SyntaxKind.BadDirectiveTrivia: 50case SyntaxKind.DefineDirectiveTrivia: 53case SyntaxKind.UndefDirectiveTrivia: 56case SyntaxKind.LineDirectiveTrivia: 59case SyntaxKind.LineSpanDirectiveTrivia: 62case SyntaxKind.PragmaChecksumDirectiveTrivia: 65case SyntaxKind.PragmaWarningDirectiveTrivia: 68case SyntaxKind.ReferenceDirectiveTrivia: 71case SyntaxKind.LoadDirectiveTrivia: 74case SyntaxKind.IgnoredDirectiveTrivia: 77case SyntaxKind.NullableDirectiveTrivia: 90if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 106if (allowComments && trivia.Kind() == SyntaxKind.SingleLineCommentTrivia) 243case SyntaxKind.HiddenKeyword: 244case SyntaxKind.DefaultKeyword: 247case SyntaxKind.NumericLiteralToken: 270if (token.Kind() != SyntaxKind.None)
CodeGeneration\CSharpSyntaxGenerator.cs (326)
55? SyntaxFactory.Token(default, SyntaxKind.InterpolatedVerbatimStringStartToken, InterpolatedVerbatimText, InterpolatedVerbatimText, default) 78SyntaxKind.MultiLineDocumentationCommentTrivia, 136case SyntaxKind.NamespaceDeclaration: 137case SyntaxKind.FileScopedNamespaceDeclaration: 138case SyntaxKind.ClassDeclaration: 139case SyntaxKind.StructDeclaration: 140case SyntaxKind.InterfaceDeclaration: 141case SyntaxKind.EnumDeclaration: 142case SyntaxKind.DelegateDeclaration: 143case SyntaxKind.RecordDeclaration: 144case SyntaxKind.RecordStructDeclaration: 178AsModifierList(accessibility, modifiers, SyntaxKind.FieldDeclaration), 239modifiers: AsModifierList(accessibility, modifiers, SyntaxKind.MethodDeclaration), 270var modifierList = AsModifierList(accessibility, modifiers, SyntaxKind.OperatorDeclaration); 296private static SyntaxKind GetOperatorSyntaxKind(string operatorName) 298var operatorKind = CSharp.SyntaxFacts.GetOperatorKind(operatorName); 299if (operatorKind == SyntaxKind.None) 368AsModifierList(accessibility, modifiers, SyntaxKind.ConstructorDeclaration), 371baseConstructorArguments != null ? SyntaxFactory.ConstructorInitializer(SyntaxKind.BaseConstructorInitializer, SyntaxFactory.ArgumentList([.. baseConstructorArguments.Select(AsArgument)])) : null, 390getAccessor = AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, modifiers.IsAbstract ? null : getAccessorStatements); 393setAccessor = AccessorDeclaration(SyntaxKind.SetAccessorDeclaration, modifiers.IsAbstract ? null : setAccessorStatements); 417AsModifierList(accessibility, actualModifiers, SyntaxKind.PropertyDeclaration), 425=> AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, accessibility, statements); 428=> AccessorDeclaration(isInitOnly ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration, accessibility, statements); 431SyntaxKind kind, Accessibility accessibility, IEnumerable<SyntaxNode>? statements) 436AsModifierList(accessibility, DeclarationModifiers.None, SyntaxKind.PropertyDeclaration)); 497accessors.Add(AccessorDeclaration(SyntaxKind.GetAccessorDeclaration, getAccessorStatements)); 502accessors.Add(AccessorDeclaration(SyntaxKind.SetAccessorDeclaration, setAccessorStatements)); 509AsModifierList(accessibility, actualModifiers, SyntaxKind.IndexerDeclaration), 523private static AccessorDeclarationSyntax AccessorDeclaration(SyntaxKind kind, IEnumerable<SyntaxNode>? statements) 545AsModifierList(accessibility, modifiers, SyntaxKind.EventFieldDeclaration), 572accessors.Add(AccessorDeclaration(SyntaxKind.AddAccessorDeclaration, addAccessorStatements)); 573accessors.Add(AccessorDeclaration(SyntaxKind.RemoveAccessorDeclaration, removeAccessorStatements)); 577AsModifierList(accessibility, modifiers, SyntaxKind.EventDeclaration), 633SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 634SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 635SyntaxKind.OperatorDeclaration => ((OperatorDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 636SyntaxKind.ConversionOperatorDeclaration => ((ConversionOperatorDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 637SyntaxKind.IndexerDeclaration => ((IndexerDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 638SyntaxKind.EventDeclaration => ((EventDeclarationSyntax)declaration).WithExplicitInterfaceSpecifier(specifier), 654case SyntaxKind.MethodDeclaration: 655case SyntaxKind.ConversionOperatorDeclaration: 656case SyntaxKind.OperatorDeclaration: 660case SyntaxKind.PropertyDeclaration: 664case SyntaxKind.IndexerDeclaration: 668case SyntaxKind.EventDeclaration: 712var kind = isRecord ? SyntaxKind.RecordDeclaration : SyntaxKind.ClassDeclaration; 735case SyntaxKind.ConstructorDeclaration: 739case SyntaxKind.VariableDeclaration: 740case SyntaxKind.VariableDeclarator: 759var kind = isRecord ? SyntaxKind.RecordStructDeclaration : SyntaxKind.StructDeclaration; 811case SyntaxKind.MethodDeclaration: 818case SyntaxKind.OperatorDeclaration: 821x.Kind() == SyntaxKind.AbstractKeyword 822|| x.Kind() == SyntaxKind.VirtualKeyword 823|| x.Kind() == SyntaxKind.PublicKeyword); 831case SyntaxKind.PropertyDeclaration: 837case SyntaxKind.IndexerDeclaration: 844case SyntaxKind.EventDeclaration: 852case SyntaxKind.EventFieldDeclaration: 857case SyntaxKind.FieldDeclaration: 883AsModifierList(accessibility, modifiers, SyntaxKind.EnumDeclaration), 901case SyntaxKind.IdentifierName: 905case SyntaxKind.FieldDeclaration: 932AsModifierList(accessibility, modifiers, SyntaxKind.DelegateDeclaration), 1019=> list.Target?.Identifier.IsKind(SyntaxKind.ReturnKeyword) ?? false; 1049case SyntaxKind.MethodDeclaration: 1050case SyntaxKind.OperatorDeclaration: 1051case SyntaxKind.ConversionOperatorDeclaration: 1052case SyntaxKind.DelegateDeclaration: 1093if (!declaration.IsKind(SyntaxKind.CompilationUnit)) 1105case SyntaxKind.AttributeList: 1113case SyntaxKind.Attribute: 1153case SyntaxKind.AttributeList: 1161case SyntaxKind.Attribute: 1173case SyntaxKind.AttributeList: 1181case SyntaxKind.Attribute: 1266case SyntaxKind.FieldDeclaration: 1270case SyntaxKind.EventFieldDeclaration: 1274case SyntaxKind.LocalDeclarationStatement: 1278case SyntaxKind.VariableDeclaration: 1282case SyntaxKind.AttributeList: 1319SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).Declaration.Variables.Count, 1320SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).Declaration.Variables.Count, 1321SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).Declaration.Variables.Count, 1322SyntaxKind.VariableDeclaration => ((VariableDeclarationSyntax)declaration).Variables.Count, 1323SyntaxKind.AttributeList => ((AttributeListSyntax)declaration).Attributes.Count, 1419if (modifiers.IsStatic && declaration.IsKind(SyntaxKind.ConstructorDeclaration) && accessibility != Accessibility.NotApplicable) 1538private static DeclarationModifiers GetAllowedModifiers(SyntaxKind kind) 1542case SyntaxKind.RecordDeclaration: 1544case SyntaxKind.ClassDeclaration: 1547case SyntaxKind.EnumDeclaration: 1550case SyntaxKind.DelegateDeclaration: 1553case SyntaxKind.InterfaceDeclaration: 1556case SyntaxKind.StructDeclaration: 1557case SyntaxKind.RecordStructDeclaration: 1560case SyntaxKind.MethodDeclaration: 1561case SyntaxKind.OperatorDeclaration: 1562case SyntaxKind.ConversionOperatorDeclaration: 1565case SyntaxKind.ConstructorDeclaration: 1568case SyntaxKind.DestructorDeclaration: 1571case SyntaxKind.FieldDeclaration: 1574case SyntaxKind.PropertyDeclaration: 1577case SyntaxKind.IndexerDeclaration: 1580case SyntaxKind.EventFieldDeclaration: 1581case SyntaxKind.EventDeclaration: 1584case SyntaxKind.GetAccessorDeclaration: 1585case SyntaxKind.SetAccessorDeclaration: 1588case SyntaxKind.AddAccessorDeclaration: 1589case SyntaxKind.RemoveAccessorDeclaration: 1592case SyntaxKind.LocalFunctionStatement: 1594case SyntaxKind.ParenthesizedLambdaExpression: 1595case SyntaxKind.SimpleLambdaExpression: 1596case SyntaxKind.AnonymousMethodExpression: 1599case SyntaxKind.EnumMemberDeclaration: 1600case SyntaxKind.Parameter: 1601case SyntaxKind.LocalDeclarationStatement: 1634(modifiers.IsStatic && declaration.IsKind(SyntaxKind.ConstructorDeclaration))) 1670SyntaxKind kind, 1851constraints = constraints.Insert(0, SyntaxFactory.ClassOrStructConstraint(isReferenceType ? SyntaxKind.ClassConstraint : SyntaxKind.StructConstraint)); 1885case SyntaxKind.ClassDeclaration: 1886case SyntaxKind.RecordDeclaration: 1888case SyntaxKind.StructDeclaration: 1889case SyntaxKind.RecordStructDeclaration: 1891case SyntaxKind.InterfaceDeclaration: 1893case SyntaxKind.EnumDeclaration: 1895case SyntaxKind.DelegateDeclaration: 1898case SyntaxKind.MethodDeclaration: 1900case SyntaxKind.OperatorDeclaration: 1902case SyntaxKind.ConversionOperatorDeclaration: 1904case SyntaxKind.ConstructorDeclaration: 1906case SyntaxKind.DestructorDeclaration: 1909case SyntaxKind.PropertyDeclaration: 1911case SyntaxKind.IndexerDeclaration: 1913case SyntaxKind.EventDeclaration: 1915case SyntaxKind.EnumMemberDeclaration: 1917case SyntaxKind.CompilationUnit: 1919case SyntaxKind.NamespaceDeclaration: 1920case SyntaxKind.FileScopedNamespaceDeclaration: 1922case SyntaxKind.UsingDirective: 1924case SyntaxKind.Parameter: 1927case SyntaxKind.ParenthesizedLambdaExpression: 1928case SyntaxKind.SimpleLambdaExpression: 1931case SyntaxKind.FieldDeclaration: 1943case SyntaxKind.EventFieldDeclaration: 1955case SyntaxKind.LocalDeclarationStatement: 1967case SyntaxKind.VariableDeclaration: 1981case SyntaxKind.VariableDeclarator: 2005case SyntaxKind.AttributeList: 2014case SyntaxKind.Attribute: 2022case SyntaxKind.GetAccessorDeclaration: 2024case SyntaxKind.SetAccessorDeclaration: 2025case SyntaxKind.InitAccessorDeclaration: 2027case SyntaxKind.AddAccessorDeclaration: 2029case SyntaxKind.RemoveAccessorDeclaration: 2037=> node?.Parent.IsKind(SyntaxKind.FieldDeclaration) ?? false; 2040=> node?.Parent.IsKind(SyntaxKind.EventFieldDeclaration) ?? false; 2043=> node?.Parent.IsKind(SyntaxKind.LocalDeclarationStatement) ?? false; 2111case SyntaxKind.DelegateDeclaration: 2113case SyntaxKind.MethodDeclaration: 2115case SyntaxKind.FieldDeclaration: 2117case SyntaxKind.PropertyDeclaration: 2119case SyntaxKind.IndexerDeclaration: 2121case SyntaxKind.EventFieldDeclaration: 2123case SyntaxKind.EventDeclaration: 2125case SyntaxKind.Parameter: 2127case SyntaxKind.LocalDeclarationStatement: 2129case SyntaxKind.VariableDeclaration: 2131case SyntaxKind.VariableDeclarator: 2144=> type is PredefinedTypeSyntax pd && pd.Keyword.IsKind(SyntaxKind.VoidKeyword) ? null : type; 2152SyntaxKind.DelegateDeclaration => ((DelegateDeclarationSyntax)declaration).WithReturnType((TypeSyntax)type), 2153SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).WithReturnType((TypeSyntax)type), 2154SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).WithDeclaration(((FieldDeclarationSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2155SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2156SyntaxKind.IndexerDeclaration => ((IndexerDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2157SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).WithDeclaration(((EventFieldDeclarationSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2158SyntaxKind.EventDeclaration => ((EventDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2159SyntaxKind.Parameter => ((ParameterSyntax)declaration).WithType((TypeSyntax)type), 2160SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).WithDeclaration(((LocalDeclarationStatementSyntax)declaration).Declaration.WithType((TypeSyntax)type)), 2161SyntaxKind.VariableDeclaration => ((VariableDeclarationSyntax)declaration).WithType((TypeSyntax)type), 2172case SyntaxKind.VariableDeclaration: 2181case SyntaxKind.VariableDeclarator: 2190case SyntaxKind.Attribute: 2218SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).Declaration, 2219SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).Declaration, 2220SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).Declaration, 2227SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).WithDeclaration(variables), 2228SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).WithDeclaration(variables), 2229SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).WithDeclaration(variables), 2237case SyntaxKind.VariableDeclaration: 2251case SyntaxKind.VariableDeclarator: 2252case SyntaxKind.Attribute: 2304currentList ??= declaration.IsKind(SyntaxKind.IndexerDeclaration) 2372case SyntaxKind.DelegateDeclaration: 2374case SyntaxKind.MethodDeclaration: 2376case SyntaxKind.OperatorDeclaration: 2378case SyntaxKind.ConversionOperatorDeclaration: 2380case SyntaxKind.ConstructorDeclaration: 2382case SyntaxKind.DestructorDeclaration: 2384case SyntaxKind.IndexerDeclaration: 2386case SyntaxKind.LocalFunctionStatement: 2388case SyntaxKind.ParenthesizedLambdaExpression: 2390case SyntaxKind.SimpleLambdaExpression: 2403case SyntaxKind.RecordDeclaration: 2404case SyntaxKind.RecordStructDeclaration: 2405case SyntaxKind.ClassDeclaration: 2406case SyntaxKind.StructDeclaration: 2407case SyntaxKind.InterfaceDeclaration: 2418case SyntaxKind.ParenthesizedLambdaExpression: 2420case SyntaxKind.SimpleLambdaExpression: 2423case SyntaxKind.PropertyDeclaration: 2432case SyntaxKind.IndexerDeclaration: 2441case SyntaxKind.MethodDeclaration: 2450case SyntaxKind.LocalFunctionStatement: 2473case SyntaxKind.ParenthesizedLambdaExpression: 2476case SyntaxKind.SimpleLambdaExpression: 2479case SyntaxKind.PropertyDeclaration: 2488case SyntaxKind.IndexerDeclaration: 2497case SyntaxKind.MethodDeclaration: 2506case SyntaxKind.LocalFunctionStatement: 2544case SyntaxKind.FieldDeclaration: 2552case SyntaxKind.PropertyDeclaration: 2555case SyntaxKind.LocalDeclarationStatement: 2563case SyntaxKind.VariableDeclaration: 2571case SyntaxKind.VariableDeclarator: 2573case SyntaxKind.Parameter: 2584case SyntaxKind.FieldDeclaration: 2592case SyntaxKind.PropertyDeclaration: 2595case SyntaxKind.LocalDeclarationStatement: 2603case SyntaxKind.VariableDeclaration: 2611case SyntaxKind.VariableDeclarator: 2613case SyntaxKind.Parameter: 2624SyntaxKind.MethodDeclaration => ((MethodDeclarationSyntax)declaration).Body?.Statements, 2625SyntaxKind.OperatorDeclaration => ((OperatorDeclarationSyntax)declaration).Body?.Statements, 2626SyntaxKind.ConversionOperatorDeclaration => ((ConversionOperatorDeclarationSyntax)declaration).Body?.Statements, 2627SyntaxKind.ConstructorDeclaration => ((ConstructorDeclarationSyntax)declaration).Body?.Statements, 2628SyntaxKind.DestructorDeclaration => ((DestructorDeclarationSyntax)declaration).Body?.Statements, 2629SyntaxKind.LocalFunctionStatement => ((LocalFunctionStatementSyntax)declaration).Body?.Statements, 2630SyntaxKind.AnonymousMethodExpression => (((AnonymousMethodExpressionSyntax)declaration).Body as BlockSyntax)?.Statements, 2631SyntaxKind.ParenthesizedLambdaExpression => (((ParenthesizedLambdaExpressionSyntax)declaration).Body as BlockSyntax)?.Statements, 2632SyntaxKind.SimpleLambdaExpression => (((SimpleLambdaExpressionSyntax)declaration).Body as BlockSyntax)?.Statements, 2633SyntaxKind.GetAccessorDeclaration or 2634SyntaxKind.SetAccessorDeclaration or 2635SyntaxKind.AddAccessorDeclaration or 2636SyntaxKind.RemoveAccessorDeclaration => ((AccessorDeclarationSyntax)declaration).Body?.Statements, 2700SyntaxKind.PropertyDeclaration => ((PropertyDeclarationSyntax)declaration).ExpressionBody == null, 2701SyntaxKind.IndexerDeclaration => ((IndexerDeclarationSyntax)declaration).ExpressionBody == null, 2702SyntaxKind.EventDeclaration => true, 2713private static AccessorListSyntax AsAccessorList(IEnumerable<SyntaxNode> nodes, SyntaxKind parentKind) 2716private static AccessorDeclarationSyntax? AsAccessor(SyntaxNode node, SyntaxKind parentKind) 2720case SyntaxKind.PropertyDeclaration: 2721case SyntaxKind.IndexerDeclaration: 2724case SyntaxKind.GetAccessorDeclaration: 2725case SyntaxKind.SetAccessorDeclaration: 2730case SyntaxKind.EventDeclaration: 2733case SyntaxKind.AddAccessorDeclaration: 2734case SyntaxKind.RemoveAccessorDeclaration: 2744private static AccessorDeclarationSyntax? GetAccessor(SyntaxNode declaration, SyntaxKind kind) 2750private SyntaxNode WithAccessor(SyntaxNode declaration, SyntaxKind kind, AccessorDeclarationSyntax accessor) 2753private SyntaxNode WithAccessor(SyntaxNode declaration, AccessorListSyntax? accessorList, SyntaxKind kind, AccessorDeclarationSyntax? accessor) 2773var accessor = GetAccessor(declaration, SyntaxKind.GetAccessorDeclaration); 2779var accessor = GetAccessor(declaration, SyntaxKind.SetAccessorDeclaration); 2784=> this.WithAccessorStatements(declaration, SyntaxKind.GetAccessorDeclaration, statements); 2787=> this.WithAccessorStatements(declaration, SyntaxKind.SetAccessorDeclaration, statements); 2789private SyntaxNode WithAccessorStatements(SyntaxNode declaration, SyntaxKind kind, IEnumerable<SyntaxNode> statements) 2916var kind = decl1.Kind(); 2921case SyntaxKind.Attribute: 2922case SyntaxKind.VariableDeclarator: 2942var kind = decl1.Kind(); 2947case SyntaxKind.FieldDeclaration: 2953case SyntaxKind.EventFieldDeclaration: 2959case SyntaxKind.LocalDeclarationStatement: 2964case SyntaxKind.AttributeList: 2968case SyntaxKind.VariableDeclaration: 3011if (declaration.Parent.IsKind(SyntaxKind.GlobalStatement)) 3050if (declaration.Parent.IsKind(SyntaxKind.GlobalStatement)) 3106SyntaxKind.FieldDeclaration => ((FieldDeclarationSyntax)declaration).Declaration.Variables, 3107SyntaxKind.EventFieldDeclaration => ((EventFieldDeclarationSyntax)declaration).Declaration.Variables, 3108SyntaxKind.LocalDeclarationStatement => ((LocalDeclarationStatementSyntax)declaration).Declaration.Variables, 3109SyntaxKind.VariableDeclaration => ((VariableDeclarationSyntax)declaration).Variables, 3110SyntaxKind.AttributeList => ((AttributeListSyntax)declaration).Attributes, 3121if (node.Parent.IsKind(SyntaxKind.GlobalStatement)) 3144case SyntaxKind.Attribute: 3154case SyntaxKind.AttributeArgument: 3163case SyntaxKind.VariableDeclarator: 3173case SyntaxKind.SimpleBaseType: 3188case SyntaxKind.SimpleBaseType: 3227=> SyntaxFactory.AssignmentExpression(SyntaxKind.AddAssignmentExpression, (ExpressionSyntax)@event, (ExpressionSyntax)ParenthesizeNonSimple(handler)); 3230=> SyntaxFactory.AssignmentExpression(SyntaxKind.SubtractAssignmentExpression, (ExpressionSyntax)@event, (ExpressionSyntax)ParenthesizeNonSimple(handler)); 3325var initializer = SyntaxFactory.InitializerExpression(SyntaxKind.ArrayInitializerExpression, AsExpressionList(elements)); 3360=> SyntaxFactory.BinaryExpression(SyntaxKind.IsExpression, (ExpressionSyntax)ParenthesizeNonSimple(expression), (TypeSyntax)type); 3366=> SyntaxFactory.BinaryExpression(SyntaxKind.AsExpression, (ExpressionSyntax)ParenthesizeNonSimple(expression), (TypeSyntax)type); 3369=> SyntaxFactory.AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, (ExpressionSyntax)left, (ExpressionSyntax)ParenthesizeNonSimple(right)); 3371private static SyntaxNode CreateBinaryExpression(SyntaxKind syntaxKind, SyntaxNode left, SyntaxNode right) 3375=> CreateBinaryExpression(SyntaxKind.EqualsExpression, left, right); 3378=> CreateBinaryExpression(SyntaxKind.EqualsExpression, left, right); 3381=> CreateBinaryExpression(SyntaxKind.NotEqualsExpression, left, right); 3384=> CreateBinaryExpression(SyntaxKind.NotEqualsExpression, left, right); 3387=> CreateBinaryExpression(SyntaxKind.LessThanExpression, left, right); 3390=> CreateBinaryExpression(SyntaxKind.LessThanOrEqualExpression, left, right); 3393=> CreateBinaryExpression(SyntaxKind.GreaterThanExpression, left, right); 3396=> CreateBinaryExpression(SyntaxKind.GreaterThanOrEqualExpression, left, right); 3399=> SyntaxFactory.PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, (ExpressionSyntax)ParenthesizeNonSimple(expression)); 3402=> CreateBinaryExpression(SyntaxKind.AddExpression, left, right); 3405=> CreateBinaryExpression(SyntaxKind.SubtractExpression, left, right); 3408=> CreateBinaryExpression(SyntaxKind.MultiplyExpression, left, right); 3411=> CreateBinaryExpression(SyntaxKind.DivideExpression, left, right); 3414=> CreateBinaryExpression(SyntaxKind.ModuloExpression, left, right); 3417=> CreateBinaryExpression(SyntaxKind.BitwiseAndExpression, left, right); 3420=> SyntaxFactory.PrefixUnaryExpression(SyntaxKind.BitwiseNotExpression, (ExpressionSyntax)ParenthesizeNonSimple(operand)); 3423=> CreateBinaryExpression(SyntaxKind.LogicalAndExpression, left, right); 3426=> CreateBinaryExpression(SyntaxKind.LogicalOrExpression, left, right); 3430SyntaxKind.LogicalNotExpression, 3437=> CreateBinaryExpression(SyntaxKind.CoalesceExpression, left, right); 3462case SyntaxKind.IdentifierName: 3466case SyntaxKind.GenericName: 3470case SyntaxKind.QualifiedName: 3474case SyntaxKind.AliasQualifiedName: 3478case SyntaxKind.SimpleMemberAccessExpression: 3479case SyntaxKind.PointerMemberAccessExpression:
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (40)
210if (typeDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword) && 220if (typeDeclaration.Kind() == SyntaxKind.ExtensionBlockDeclaration) 229typeDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword), 251enumDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword), 271case SyntaxKind.ConstructorDeclaration: 279ctorDecl.Modifiers.Any(SyntaxKind.PartialKeyword), 287case SyntaxKind.DelegateDeclaration: 295delegateDecl.Modifiers.Any(SyntaxKind.PartialKeyword), 302case SyntaxKind.EnumMemberDeclaration: 309enumMember.Modifiers.Any(SyntaxKind.PartialKeyword), 316case SyntaxKind.EventDeclaration: 323eventDecl.Modifiers.Any(SyntaxKind.PartialKeyword), 330case SyntaxKind.IndexerDeclaration: 337indexerDecl.Modifiers.Any(SyntaxKind.PartialKeyword), 344case SyntaxKind.MethodDeclaration: 352method.Modifiers.Any(SyntaxKind.PartialKeyword), 361case SyntaxKind.PropertyDeclaration: 368property.Modifiers.Any(SyntaxKind.PartialKeyword), 375case SyntaxKind.FieldDeclaration: 376case SyntaxKind.EventFieldDeclaration: 382: fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword) 391fieldDeclaration.Modifiers.Any(SyntaxKind.PartialKeyword), 486=> constructor.Modifiers.Any(SyntaxKind.StaticKeyword) 611=> method.ParameterList.Parameters is [var parameter, ..] && parameter.Modifiers.Any(SyntaxKind.ThisKeyword); 709var kind = predefinedTypeNode.Keyword.Kind(); 712SyntaxKind.BoolKeyword => "Boolean", 713SyntaxKind.ByteKeyword => "Byte", 714SyntaxKind.SByteKeyword => "SByte", 715SyntaxKind.ShortKeyword => "Int16", 716SyntaxKind.UShortKeyword => "UInt16", 717SyntaxKind.IntKeyword => "Int32", 718SyntaxKind.UIntKeyword => "UInt32", 719SyntaxKind.LongKeyword => "Int64", 720SyntaxKind.ULongKeyword => "UInt64", 721SyntaxKind.DoubleKeyword => "Double", 722SyntaxKind.FloatKeyword => "Single", 723SyntaxKind.DecimalKeyword => "Decimal", 724SyntaxKind.StringKeyword => "String", 725SyntaxKind.CharKeyword => "Char", 726SyntaxKind.ObjectKeyword => "Object",
FindSymbols\FindSymbolsUtilities.cs (17)
19case SyntaxKind.PublicKeyword: return Accessibility.Public; 20case SyntaxKind.PrivateKeyword: return Accessibility.Private; 21case SyntaxKind.ProtectedKeyword: return Accessibility.Protected; 22case SyntaxKind.InternalKeyword: 34case SyntaxKind.ClassDeclaration: 35case SyntaxKind.ExtensionBlockDeclaration: 36case SyntaxKind.RecordDeclaration: 37case SyntaxKind.StructDeclaration: 38case SyntaxKind.RecordStructDeclaration: 41case SyntaxKind.InterfaceDeclaration: 44case SyntaxKind.CompilationUnit: 61SyntaxKind.ClassDeclaration => DeclaredSymbolInfoKind.Class, 62SyntaxKind.InterfaceDeclaration => DeclaredSymbolInfoKind.Interface, 63SyntaxKind.StructDeclaration => DeclaredSymbolInfoKind.Struct, 64SyntaxKind.RecordDeclaration => DeclaredSymbolInfoKind.Record, 65SyntaxKind.RecordStructDeclaration => DeclaredSymbolInfoKind.RecordStruct, 66SyntaxKind.UnionDeclaration => DeclaredSymbolInfoKind.Union,
ReassignedVariable\CSharpReassignedVariableService.cs (1)
44if (current is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword })
Recommendations\CSharpRecommendationServiceRunner.cs (19)
142MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess 152MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess 154MemberAccessExpressionSyntax(SyntaxKind.PointerMemberAccessExpression) memberAccess 167if (node is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression)) 171if (current.Kind() == SyntaxKind.ConstantPattern) 174if (current.Kind() == SyntaxKind.ParenthesizedExpression) 177if (current.Kind() == SyntaxKind.SimpleMemberAccessExpression) 188if (current is BinaryExpressionSyntax(SyntaxKind.IsExpression) binaryExpression && 194if (current.Kind() == SyntaxKind.QualifiedName) 197if (current.Kind() == SyntaxKind.AliasQualifiedName) 305.Kind() is SyntaxKind.LabeledStatement or SyntaxKind.DefaultSwitchLabel); 524AnonymousFunctionExpressionSyntax anonymousFunction => anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword), 525LocalFunctionStatementSyntax localFunction => localFunction.Modifiers.Any(SyntaxKind.StaticKeyword), 582return new RecommendedSymbols(usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword) 776var originalExpressionKind = originalExpression.Kind(); 780if (originalExpressionKind is SyntaxKind.ParenthesizedExpression && 788originalExpressionKind is SyntaxKind.IdentifierName or SyntaxKind.GenericName)
Rename\CSharpRenameRewriterLanguageService.cs (35)
222if (newToken.Parent.IsKind(SyntaxKind.XmlName)) 258=> token.IsKind(SyntaxKind.GetKeyword) 262=> token.IsKind(SyntaxKind.SetKeyword) 266=> token.IsKind(SyntaxKind.InitKeyword) 277token.IsKind(SyntaxKind.IdentifierToken) && 278token.Parent.IsKind(SyntaxKind.DestructorDeclaration); 379if (!isRenameLocation && symbol is INamespaceSymbol && token.GetPreviousToken().IsKind(SyntaxKind.NamespaceKeyword)) 398if (isRenameLocation && token.GetPreviousToken().IsKind(SyntaxKind.NamespaceKeyword)) 441case SyntaxKind.IdentifierName: 442case SyntaxKind.GenericName: 446case SyntaxKind.SimpleMemberAccessExpression: 450case SyntaxKind.QualifiedName: 454case SyntaxKind.AliasQualifiedName: 458case SyntaxKind.ParenthesizedExpression: 537!token.IsKind(SyntaxKind.GlobalKeyword) && 538token.Parent.Parent is (kind: SyntaxKind.AliasQualifiedName or SyntaxKind.QualifiedCref or SyntaxKind.QualifiedName)) 595var kind = SyntaxFacts.GetKeywordKind(currentNewIdentifier); 596if (kind != SyntaxKind.None) 615: newToken.CopyAnnotationsTo(SyntaxFactory.Identifier(newToken.LeadingTrivia, SyntaxKind.IdentifierToken, currentNewIdentifier, valueText, newToken.TrailingTrivia)); 689if (newToken.IsKind(SyntaxKind.StringLiteralToken)) 693else if (newToken.IsKind(SyntaxKind.InterpolatedStringTextToken)) 696SyntaxFactory.Token(newToken.LeadingTrivia, SyntaxKind.InterpolatedStringTextToken, text, value, newToken.TrailingTrivia)); 702if (newToken.IsKind(SyntaxKind.XmlTextLiteralToken)) 706else if (newToken.IsKind(SyntaxKind.IdentifierToken) && newToken.Parent.IsKind(SyntaxKind.XmlName) && newToken.ValueText == _originalText) 744if (token.Parent is ExpressionSyntax(SyntaxKind.IdentifierName) expression && 745token.Parent.IsParentKind(SyntaxKind.InvocationExpression) && 746token.GetPreviousToken().Kind() != SyntaxKind.DotToken && 747token.GetNextToken().Kind() != SyntaxKind.DotToken) 975case SyntaxKind.ForEachKeyword: 977case SyntaxKind.AwaitKeyword: 1087var kind = SyntaxFacts.GetKeywordKind(replacementText); 1088if (kind != SyntaxKind.None)
Rename\LocalConflictVisitor.cs (4)
166case SyntaxKind.FromClause: 171case SyntaxKind.LetClause: 187foreach (var child in body.ChildNodes().Where(c => c.Kind() != SyntaxKind.QueryContinuation)) 207var statements = node.ChildNodes().Where(x => x.IsKind(SyntaxKind.SwitchSection)).SelectMany(x => x.ChildNodes());
Simplification\CSharpSimplificationService.cs (9)
103if (SyntaxFacts.GetKeywordKind(syntaxToken.ValueText) == SyntaxKind.None && SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.None) 108if (SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.UnderscoreToken) 114if (parentOfToken is SimpleNameSyntax && parent.IsKind(SyntaxKind.XmlNameAttribute)) 121if (parent.IsKind(SyntaxKind.AliasQualifiedName) && 205Debug.Assert(tuple.IsKind(SyntaxKind.TupleExpression)); 210if (parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 215if (!parent.IsKind(SyntaxKind.Argument)) 221if (!grandParent.IsKind(SyntaxKind.TupleExpression))
Simplification\CSharpSimplificationService.Expander.cs (40)
33private static readonly SyntaxTrivia s_oneWhitespaceSeparator = SyntaxTrivia(SyntaxKind.WhitespaceTrivia, " "); 79argument.IsParentKind(SyntaxKind.ArgumentList) && 274node.Expression.Kind() != SyntaxKind.DeclarationExpression && 275node.RefOrOutKeyword.Kind() == SyntaxKind.None) 362if ((node.Kind() == SyntaxKind.GreaterThanExpression || node.Kind() == SyntaxKind.RightShiftExpression) && !node.IsParentKind(SyntaxKind.ParenthesizedExpression)) 374if (result.Expression != null && !result.Expression.IsKind(SyntaxKind.ParenthesizedExpression)) 408else if (rewrittenname.Kind() == SyntaxKind.AliasQualifiedName) 493case SyntaxKind.AliasQualifiedName: 509case SyntaxKind.QualifiedName: 517case SyntaxKind.IdentifierName: 611case SyntaxKind.IdentifierName: 612case SyntaxKind.GenericName: 626(parent is MemberAccessExpressionSyntax && parent.Kind() != SyntaxKind.SimpleMemberAccessExpression) || 627((parent.Kind() == SyntaxKind.SimpleMemberAccessExpression || parent.Kind() == SyntaxKind.NameMemberCref) && originalSimpleName.IsRightSideOfDot()) || 628(parent.Kind() == SyntaxKind.QualifiedName && originalSimpleName.IsRightSideOfQualifiedName()) || 629(parent.Kind() == SyntaxKind.AliasQualifiedName) || 630(parent.Kind() == SyntaxKind.NameColon)) 640if (symbol.IsConstructor() && (parent.Kind() == SyntaxKind.ObjectCreationExpression || parent.Kind() == SyntaxKind.NameMemberCref)) 666originalSimpleName.IsParentKind(SyntaxKind.NameMemberCref) || 699SyntaxKind.SimpleMemberAccessExpression, 722if (candidateToken.Kind() is SyntaxKind.LessThanToken or SyntaxKind.GreaterThanToken) 737if (newNode.Kind() == SyntaxKind.IdentifierName && 865if (parent.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.WithInitializerExpression) 867return currentNode.Kind() == SyntaxKind.SimpleAssignmentExpression && 894Debug.Assert(!replaceNode || rewrittenNode.Kind() == SyntaxKind.IdentifierName); 948case SyntaxKind.QualifiedName: 956case SyntaxKind.SimpleMemberAccessExpression: 959SyntaxKind.SimpleMemberAccessExpression, 982SyntaxKind.SimpleMemberAccessExpression, 999if (oldToken.Kind() == SyntaxKind.LessThanToken) 1001return Token(oldToken.LeadingTrivia, SyntaxKind.LessThanToken, "{", "{", oldToken.TrailingTrivia); 1004if (oldToken.Kind() == SyntaxKind.GreaterThanToken) 1006return Token(oldToken.LeadingTrivia, SyntaxKind.GreaterThanToken, "}", "}", oldToken.TrailingTrivia); 1043if (originalNode.Expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess)
Simplification\CSharpSimplificationService.NodesAndTokensToReduceComputer.cs (1)
106if (_simplifyAllDescendants && !_insideSpeculatedNode && !token.IsKind(SyntaxKind.None))
Simplification\Reducers\CSharpCastReducer.Rewriter.cs (4)
37if ((node.Left.IsKind(SyntaxKind.CastExpression) && !reducedNode.Left.IsKind(SyntaxKind.CastExpression)) || 38(node.Right.IsKind(SyntaxKind.CastExpression) && !reducedNode.Right.IsKind(SyntaxKind.CastExpression)))
Simplification\Reducers\CSharpDefaultExpressionReducer.Rewriter.cs (1)
37return SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression)
Simplification\Reducers\CSharpEscapingReducer.cs (19)
43if (SyntaxFacts.GetKeywordKind(unescapedIdentifier) != SyntaxKind.None && enclosingXmlNameAttr == null) 53if (SyntaxFacts.GetContextualKeywordKind(unescapedIdentifier) == SyntaxKind.AwaitKeyword) 60if (enclosingMethodBlock != null && enclosingMethodBlock.Modifiers.Any(SyntaxKind.AsyncKeyword)) 69case SyntaxKind.FromKeyword: 70case SyntaxKind.WhereKeyword: 71case SyntaxKind.SelectKeyword: 72case SyntaxKind.GroupKeyword: 73case SyntaxKind.IntoKeyword: 74case SyntaxKind.OrderByKeyword: 75case SyntaxKind.JoinKeyword: 76case SyntaxKind.LetKeyword: 77case SyntaxKind.InKeyword: 78case SyntaxKind.OnKeyword: 79case SyntaxKind.EqualsKeyword: 80case SyntaxKind.ByKeyword: 81case SyntaxKind.AscendingKeyword: 82case SyntaxKind.DescendingKeyword: 87var result = token.Kind() == SyntaxKind.IdentifierToken ? CreateNewIdentifierTokenFromToken(token, escape: false) : token; 122: originalToken.CopyAnnotationsTo(SyntaxFactory.Identifier(originalToken.LeadingTrivia, SyntaxKind.IdentifierToken, unescapedText, originalToken.ValueText, originalToken.TrailingTrivia));
Simplification\Reducers\CSharpExtensionMethodReducer.cs (7)
40if (node.Expression.Kind() == SyntaxKind.SimpleMemberAccessExpression) 75if (node.Expression.Kind() == SyntaxKind.SimpleMemberAccessExpression) 78SyntaxKind.SimpleMemberAccessExpression, expression, 82else if (node.Expression.Kind() == SyntaxKind.IdentifierName) 85SyntaxKind.SimpleMemberAccessExpression, expression, 88else if (node.Expression.Kind() == SyntaxKind.GenericName) 91SyntaxKind.SimpleMemberAccessExpression, expression,
Simplification\Reducers\CSharpInferredMemberNameReducer.Rewriter.cs (1)
55if (node.Parent.IsKind(SyntaxKind.TupleExpression))
Simplification\Reducers\CSharpMiscellaneousReducer.cs (14)
40if (parameterSyntax.IsParentKind(SyntaxKind.ParameterList) && 41parameterSyntax.Parent.IsParentKind(SyntaxKind.ParenthesizedLambdaExpression)) 142if (!node.Parent.IsKind(SyntaxKind.IfStatement)) 148if (node.Parent?.Parent is (kind: SyntaxKind.IfStatement or SyntaxKind.ElseClause)) 182case SyntaxKind.IfStatement: 183case SyntaxKind.ElseClause: 184case SyntaxKind.ForStatement: 185case SyntaxKind.ForEachStatement: 186case SyntaxKind.ForEachVariableStatement: 187case SyntaxKind.WhileStatement: 188case SyntaxKind.DoStatement: 189case SyntaxKind.UsingStatement: 190case SyntaxKind.LockStatement:
Simplification\Reducers\CSharpNameReducer.Rewriter.cs (2)
206var isOrAsNode = node.Kind() is SyntaxKind.AsExpression or SyntaxKind.IsExpression;
Simplification\Simplifiers\AbstractCSharpSimplifier.cs (26)
39var kind = specialType switch 41SpecialType.System_Boolean => SyntaxKind.BoolKeyword, 42SpecialType.System_Byte => SyntaxKind.ByteKeyword, 43SpecialType.System_SByte => SyntaxKind.SByteKeyword, 44SpecialType.System_Int32 => SyntaxKind.IntKeyword, 45SpecialType.System_UInt32 => SyntaxKind.UIntKeyword, 46SpecialType.System_Int16 => SyntaxKind.ShortKeyword, 47SpecialType.System_UInt16 => SyntaxKind.UShortKeyword, 48SpecialType.System_Int64 => SyntaxKind.LongKeyword, 49SpecialType.System_UInt64 => SyntaxKind.ULongKeyword, 50SpecialType.System_Single => SyntaxKind.FloatKeyword, 51SpecialType.System_Double => SyntaxKind.DoubleKeyword, 52SpecialType.System_Decimal => SyntaxKind.DecimalKeyword, 53SpecialType.System_String => SyntaxKind.StringKeyword, 54SpecialType.System_Char => SyntaxKind.CharKeyword, 55SpecialType.System_Object => SyntaxKind.ObjectKeyword, 56SpecialType.System_Void => SyntaxKind.VoidKeyword, 57_ => SyntaxKind.None, 60if (kind != SyntaxKind.None) 133if (node.Kind() == SyntaxKind.IdentifierName && 186while (current is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) currentMember) 192return current.Kind() is SyntaxKind.AliasQualifiedName or SyntaxKind.IdentifierName or SyntaxKind.GenericName or SyntaxKind.QualifiedName; 373TypeSyntax node = token.Kind() == SyntaxKind.IdentifierToken
Simplification\Simplifiers\ExpressionSimplifier.cs (7)
77if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess) 155SyntaxKind.IdentifierToken, 199if (!memberAccess.Expression.IsKind(SyntaxKind.BaseExpression)) 283case MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess: 345if (memberAccess.Expression.Kind() == SyntaxKind.BaseExpression) 395if (constructor == null || constructor.GetRequiredParent().Kind() is not (SyntaxKind.StructDeclaration or SyntaxKind.RecordStructDeclaration))
Simplification\Simplifiers\MemberAccessExpressionSimplifier.cs (8)
45if (parent.IsParentKind(SyntaxKind.SimpleMemberAccessExpression)) 51if (!parent.IsParentKind(SyntaxKind.ParenthesizedExpression)) 74if ((nextToken.Kind() is SyntaxKind.TildeToken or SyntaxKind.ExclamationToken or SyntaxKind.OpenParenToken) || 75(CSharp.SyntaxFacts.IsKeywordKind(nextToken.Kind()) && nextToken.Kind() is not SyntaxKind.AsKeyword and not SyntaxKind.IsKeyword)) 89return node is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess
Simplification\Simplifiers\NameSimplifier.cs (21)
85if (symbol.Kind == SymbolKind.Method && name.Kind() == SyntaxKind.GenericName) 130SyntaxKind.IdentifierToken, 170if (name.Kind() == SyntaxKind.QualifiedName) 241if (!name.Parent.IsKind(SyntaxKind.QualifiedName) && (inDeclarationContext || inMemberAccessContext)) 278if (name.Kind() == SyntaxKind.QualifiedName) 288if (oldType.Kind() == SyntaxKind.OmittedTypeArgument) 311case SyntaxKind.AliasQualifiedName: 326case SyntaxKind.QualifiedName: 332case SyntaxKind.IdentifierName: 341case SyntaxKind.GenericName: 496if (name.Parent.Kind() == SyntaxKind.Attribute || name.IsRightSideOfDotOrColonColon()) 506if (SyntaxFacts.GetKeywordKind(newAttributeName) != SyntaxKind.None) 559case SyntaxKind.IdentifierName: 560case SyntaxKind.QualifiedName: 565case SyntaxKind.NamespaceDeclaration: 566case SyntaxKind.FileScopedNamespaceDeclaration: 629if (nullableType.ElementType.Kind() == SyntaxKind.OmittedTypeArgument) 641if (simplifiedNode.Kind() == SyntaxKind.NullableType && 653expression.IsParentKind(SyntaxKind.UsingDirective) && 668if (!reparsedCastExpression.IsKind(SyntaxKind.CastExpression)) 711aliasName.Alias.Identifier.IsKind(SyntaxKind.GlobalKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeGeneration\CSharpSyntaxTokens.cs (97)
11public static readonly SyntaxToken AbstractKeyword = Token(SyntaxKind.AbstractKeyword); 12public static readonly SyntaxToken AsKeyword = Token(SyntaxKind.AsKeyword); 13public static readonly SyntaxToken AssemblyKeyword = Token(SyntaxKind.AssemblyKeyword); 14public static readonly SyntaxToken AsyncKeyword = Token(SyntaxKind.AsyncKeyword); 15public static readonly SyntaxToken AwaitKeyword = Token(SyntaxKind.AwaitKeyword); 16public static readonly SyntaxToken BoolKeyword = Token(SyntaxKind.BoolKeyword); 17public static readonly SyntaxToken BreakKeyword = Token(SyntaxKind.BreakKeyword); 18public static readonly SyntaxToken ByteKeyword = Token(SyntaxKind.ByteKeyword); 19public static readonly SyntaxToken CaseKeyword = Token(SyntaxKind.CaseKeyword); 20public static readonly SyntaxToken CharKeyword = Token(SyntaxKind.CharKeyword); 21public static readonly SyntaxToken CheckedKeyword = Token(SyntaxKind.CheckedKeyword); 22public static readonly SyntaxToken CloseBraceToken = Token(SyntaxKind.CloseBraceToken); 23public static readonly SyntaxToken CloseBracketToken = Token(SyntaxKind.CloseBracketToken); 25public static readonly SyntaxToken ClosedKeyword = Token(SyntaxKind.ClosedKeyword); 27public static readonly SyntaxToken CloseParenToken = Token(SyntaxKind.CloseParenToken); 28public static readonly SyntaxToken ColonToken = Token(SyntaxKind.ColonToken); 29public static readonly SyntaxToken CommaToken = Token(SyntaxKind.CommaToken); 30public static readonly SyntaxToken ConstKeyword = Token(SyntaxKind.ConstKeyword); 31public static readonly SyntaxToken ContinueKeyword = Token(SyntaxKind.ContinueKeyword); 32public static readonly SyntaxToken DecimalKeyword = Token(SyntaxKind.DecimalKeyword); 33public static readonly SyntaxToken DisableKeyword = Token(SyntaxKind.DisableKeyword); 34public static readonly SyntaxToken DotDotToken = Token(SyntaxKind.DotDotToken); 35public static readonly SyntaxToken DoubleKeyword = Token(SyntaxKind.DoubleKeyword); 36public static readonly SyntaxToken EndOfDocumentationCommentToken = Token(SyntaxKind.EndOfDocumentationCommentToken); 37public static readonly SyntaxToken EqualsToken = Token(SyntaxKind.EqualsToken); 38public static readonly SyntaxToken ExplicitKeyword = Token(SyntaxKind.ExplicitKeyword); 40public static readonly SyntaxToken ExtensionKeyword = Token(SyntaxKind.ExtensionKeyword); 42public static readonly SyntaxToken ExternKeyword = Token(SyntaxKind.ExternKeyword); 43public static readonly SyntaxToken FileKeyword = Token(SyntaxKind.FileKeyword); 44public static readonly SyntaxToken FixedKeyword = Token(SyntaxKind.FixedKeyword); 45public static readonly SyntaxToken FloatKeyword = Token(SyntaxKind.FloatKeyword); 46public static readonly SyntaxToken ForEachKeyword = Token(SyntaxKind.ForEachKeyword); 47public static readonly SyntaxToken FromKeyword = Token(SyntaxKind.FromKeyword); 48public static readonly SyntaxToken GlobalKeyword = Token(SyntaxKind.GlobalKeyword); 49public static readonly SyntaxToken GreaterThanEqualsToken = Token(SyntaxKind.GreaterThanEqualsToken); 50public static readonly SyntaxToken GreaterThanToken = Token(SyntaxKind.GreaterThanToken); 51public static readonly SyntaxToken IfKeyword = Token(SyntaxKind.IfKeyword); 52public static readonly SyntaxToken ImplicitKeyword = Token(SyntaxKind.ImplicitKeyword); 53public static readonly SyntaxToken InKeyword = Token(SyntaxKind.InKeyword); 54public static readonly SyntaxToken InterfaceKeyword = Token(SyntaxKind.InterfaceKeyword); 55public static readonly SyntaxToken InternalKeyword = Token(SyntaxKind.InternalKeyword); 56public static readonly SyntaxToken InterpolatedStringEndToken = Token(SyntaxKind.InterpolatedStringEndToken); 57public static readonly SyntaxToken InterpolatedStringStartToken = Token(SyntaxKind.InterpolatedStringStartToken); 58public static readonly SyntaxToken IntKeyword = Token(SyntaxKind.IntKeyword); 59public static readonly SyntaxToken IsKeyword = Token(SyntaxKind.IsKeyword); 60public static readonly SyntaxToken LessThanEqualsToken = Token(SyntaxKind.LessThanEqualsToken); 61public static readonly SyntaxToken LessThanToken = Token(SyntaxKind.LessThanToken); 62public static readonly SyntaxToken LetKeyword = Token(SyntaxKind.LetKeyword); 63public static readonly SyntaxToken LongKeyword = Token(SyntaxKind.LongKeyword); 64public static readonly SyntaxToken MethodKeyword = Token(SyntaxKind.MethodKeyword); 65public static readonly SyntaxToken NewKeyword = Token(SyntaxKind.NewKeyword); 66public static readonly SyntaxToken NotKeyword = Token(SyntaxKind.NotKeyword); 67public static readonly SyntaxToken NullKeyword = Token(SyntaxKind.NullKeyword); 68public static readonly SyntaxToken ObjectKeyword = Token(SyntaxKind.ObjectKeyword); 69public static readonly SyntaxToken OpenBraceToken = Token(SyntaxKind.OpenBraceToken); 70public static readonly SyntaxToken OpenBracketToken = Token(SyntaxKind.OpenBracketToken); 71public static readonly SyntaxToken OpenParenToken = Token(SyntaxKind.OpenParenToken); 72public static readonly SyntaxToken OperatorKeyword = Token(SyntaxKind.OperatorKeyword); 73public static readonly SyntaxToken OutKeyword = Token(SyntaxKind.OutKeyword); 74public static readonly SyntaxToken OverrideKeyword = Token(SyntaxKind.OverrideKeyword); 75public static readonly SyntaxToken ParamsKeyword = Token(SyntaxKind.ParamsKeyword); 76public static readonly SyntaxToken PartialKeyword = Token(SyntaxKind.PartialKeyword); 77public static readonly SyntaxToken PlusToken = Token(SyntaxKind.PlusToken); 78public static readonly SyntaxToken PrivateKeyword = Token(SyntaxKind.PrivateKeyword); 79public static readonly SyntaxToken PropertyKeyword = Token(SyntaxKind.PropertyKeyword); 80public static readonly SyntaxToken ProtectedKeyword = Token(SyntaxKind.ProtectedKeyword); 81public static readonly SyntaxToken PublicKeyword = Token(SyntaxKind.PublicKeyword); 82public static readonly SyntaxToken QuestionQuestionEqualsToken = Token(SyntaxKind.QuestionQuestionEqualsToken); 83public static readonly SyntaxToken QuestionToken = Token(SyntaxKind.QuestionToken); 84public static readonly SyntaxToken ReadOnlyKeyword = Token(SyntaxKind.ReadOnlyKeyword); 85public static readonly SyntaxToken RecordKeyword = Token(SyntaxKind.RecordKeyword); 86public static readonly SyntaxToken RefKeyword = Token(SyntaxKind.RefKeyword); 87public static readonly SyntaxToken RequiredKeyword = Token(SyntaxKind.RequiredKeyword); 88public static readonly SyntaxToken RestoreKeyword = Token(SyntaxKind.RestoreKeyword); 89public static readonly SyntaxToken ReturnKeyword = Token(SyntaxKind.ReturnKeyword); 90public static readonly SyntaxToken SByteKeyword = Token(SyntaxKind.SByteKeyword); 91public static readonly SyntaxToken ScopedKeyword = Token(SyntaxKind.ScopedKeyword); 92public static readonly SyntaxToken SealedKeyword = Token(SyntaxKind.SealedKeyword); 93public static readonly SyntaxToken SemicolonToken = Token(SyntaxKind.SemicolonToken); 94public static readonly SyntaxToken ShortKeyword = Token(SyntaxKind.ShortKeyword); 95public static readonly SyntaxToken SlashGreaterThanToken = Token(SyntaxKind.SlashGreaterThanToken); 96public static readonly SyntaxToken StaticKeyword = Token(SyntaxKind.StaticKeyword); 97public static readonly SyntaxToken StringKeyword = Token(SyntaxKind.StringKeyword); 98public static readonly SyntaxToken StructKeyword = Token(SyntaxKind.StructKeyword); 99public static readonly SyntaxToken SwitchKeyword = Token(SyntaxKind.SwitchKeyword); 100public static readonly SyntaxToken ThisKeyword = Token(SyntaxKind.ThisKeyword); 101public static readonly SyntaxToken TildeToken = Token(SyntaxKind.TildeToken); 102public static readonly SyntaxToken UIntKeyword = Token(SyntaxKind.UIntKeyword); 103public static readonly SyntaxToken ULongKeyword = Token(SyntaxKind.ULongKeyword); 104public static readonly SyntaxToken UnmanagedKeyword = Token(SyntaxKind.UnmanagedKeyword); 105public static readonly SyntaxToken UnsafeKeyword = Token(SyntaxKind.UnsafeKeyword); 106public static readonly SyntaxToken UShortKeyword = Token(SyntaxKind.UShortKeyword); 107public static readonly SyntaxToken UsingKeyword = Token(SyntaxKind.UsingKeyword); 108public static readonly SyntaxToken VirtualKeyword = Token(SyntaxKind.VirtualKeyword); 109public static readonly SyntaxToken VoidKeyword = Token(SyntaxKind.VoidKeyword); 110public static readonly SyntaxToken VolatileKeyword = Token(SyntaxKind.VolatileKeyword); 111public static readonly SyntaxToken WhereKeyword = Token(SyntaxKind.WhereKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\CSharpCodeStyleOptions.cs (19)
157private static readonly ImmutableArray<SyntaxKind> s_preferredModifierOrderDefault = 159SyntaxKind.PublicKeyword, 160SyntaxKind.PrivateKeyword, 161SyntaxKind.ProtectedKeyword, 162SyntaxKind.InternalKeyword, 163SyntaxKind.FileKeyword, 164SyntaxKind.StaticKeyword, 165SyntaxKind.ExternKeyword, 166SyntaxKind.NewKeyword, 167SyntaxKind.VirtualKeyword, 168SyntaxKind.AbstractKeyword, 170SyntaxKind.ClosedKeyword, 172SyntaxKind.SealedKeyword, 173SyntaxKind.OverrideKeyword, 174SyntaxKind.ReadOnlyKeyword, 175SyntaxKind.UnsafeKeyword, 176SyntaxKind.RequiredKeyword, 177SyntaxKind.VolatileKeyword, 178SyntaxKind.AsyncKeyword,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (7)
66if (initializerExpression.IsKind(SyntaxKind.DefaultExpression)) 79if (initializerExpression.Kind() is SyntaxKind.ObjectCreationExpression or SyntaxKind.ArrayCreationExpression && 80!initializerExpression.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 87if (initializerExpression.Kind() is SyntaxKind.CastExpression or SyntaxKind.IsExpression or SyntaxKind.AsExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (18)
35if (token.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 38if (token.Parent?.Parent is InterpolatedStringExpressionSyntax { StringStartToken.RawKind: (int)SyntaxKind.InterpolatedMultiLineRawStringStartToken }) 63case SyntaxKind.CharacterLiteralToken: 66case SyntaxKind.StringLiteralToken: 71case SyntaxKind.Utf8StringLiteralToken: 76case SyntaxKind.SingleLineRawStringLiteralToken: 77case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 80case SyntaxKind.MultiLineRawStringLiteralToken: 81case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 86case SyntaxKind.InterpolatedStringTextToken: 97SyntaxKind.InterpolatedStringStartToken => TryConvertStringToVirtualChars(token, "", "", escapeBraces: true), 98SyntaxKind.InterpolatedVerbatimStringStartToken => TryConvertVerbatimStringToVirtualChars(token, "", "", escapeBraces: true), 99SyntaxKind.InterpolatedSingleLineRawStringStartToken => TryConvertSingleLineRawStringToVirtualChars(token), 100SyntaxKind.InterpolatedMultiLineRawStringStartToken 138if (token.Kind() is SyntaxKind.Utf8SingleLineRawStringLiteralToken) 144if (token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (5)
27SyntaxKind.RefKeyword => RefKind.Ref, 28SyntaxKind.OutKeyword => RefKind.Out, 29SyntaxKind.InKeyword => RefKind.In, 81if (argument.RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword && 87if (argument.RefOrOutKeyword.Kind() == SyntaxKind.RefKeyword &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\AssignmentExpressionSyntaxExtensions.cs (4)
16return assignment.Kind() == SyntaxKind.SimpleAssignmentExpression && 17assignment.OperatorToken.Kind() == SyntaxKind.EqualsToken && 18(left.Kind() == SyntaxKind.TupleExpression || left.Kind() == SyntaxKind.DeclarationExpression);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (15)
27Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.IfDirectiveTrivia), nameof(IfDirectiveTriviaSyntax)), 29Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElifDirectiveTrivia), nameof(ElifDirectiveTriviaSyntax))), 30Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElseDirectiveTrivia), nameof(ElseDirectiveTriviaSyntax)), 31Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.EndIfDirectiveTrivia), nameof(EndIfDirectiveTriviaSyntax))); 78if (leadingDirectives.Any(t => t.Kind() == SyntaxKind.EndIfDirectiveTrivia)) 113if (nextTrivia.Kind() == SyntaxKind.DisabledTextTrivia) 137SyntaxKind declarationKind, 157if (parent.Kind() == SyntaxKind.GetAccessorDeclaration) 175private static bool IsSupportedInCSharp6(SyntaxKind declarationKind) 179case SyntaxKind.ConstructorDeclaration: 180case SyntaxKind.DestructorDeclaration: 181case SyntaxKind.AddAccessorDeclaration: 182case SyntaxKind.RemoveAccessorDeclaration: 183case SyntaxKind.GetAccessorDeclaration: 184case SyntaxKind.SetAccessorDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (2)
16SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression); 69if (equalsValueClause.IsParentKind(SyntaxKind.VariableDeclarator) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DirectiveSyntaxExtensions.cs (6)
63=> directive?.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia; 67is SyntaxKind.IfDirectiveTrivia 68or SyntaxKind.ElifDirectiveTrivia 69or SyntaxKind.ElseDirectiveTrivia 70or SyntaxKind.EndIfDirectiveTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (138)
38while (expression is PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfixExpression) 48=> expression?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == expression; 84return firstToken.Kind() != SyntaxKind.None 85&& firstToken.GetPreviousToken().Kind() == SyntaxKind.CloseParenToken; 98=> (expression?.Parent) is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && 109=> name.IsParentKind(SyntaxKind.ExplicitInterfaceSpecifier); 130if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess) 160if (!simpleName.IsKind(SyntaxKind.IdentifierName)) 187if (expression.IsParentKind(SyntaxKind.ConstantPattern)) 197=> expression?.Parent is ArgumentSyntax { RefOrOutKeyword: SyntaxToken(SyntaxKind.OutKeyword) } argument && 209while (expression?.Parent is ParenthesizedExpressionSyntax or PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression)) 213ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.RefKeyword }) 224=> expression?.Parent is ArgumentSyntax { RefKindKeyword: SyntaxToken(SyntaxKind.InKeyword) }; 275if (!expr.IsParentKind(SyntaxKind.Argument)) 290case SyntaxKind.Argument: 291if (parent.Parent?.Kind() == SyntaxKind.TupleExpression) 298case SyntaxKind.SimpleAssignmentExpression: 305case SyntaxKind.ForEachVariableStatement: 355if (expression.Parent.IsKind(SyntaxKind.AddressOfExpression)) 400return nameEquals.IsParentKind(SyntaxKind.AttributeArgument); 409case SyntaxKind.PostIncrementExpression: 410case SyntaxKind.PreIncrementExpression: 411case SyntaxKind.PostDecrementExpression: 412case SyntaxKind.PreDecrementExpression: 428name.Identifier.Text == SyntaxFacts.GetText(SyntaxKind.NameOfKeyword)) 467if (expression.IsKind(SyntaxKind.StackAllocArrayCreationExpression)) 476is SyntaxKind.BaseExpression 477or SyntaxKind.CollectionInitializerExpression 478or SyntaxKind.ObjectInitializerExpression 479or SyntaxKind.ComplexElementInitializerExpression) 485if (expression is LiteralExpressionSyntax && !expression.IsParentKind(SyntaxKind.UnaryMinusExpression)) 515if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 517return expression is { Parent.RawKind: not (int)SyntaxKind.ConditionalAccessExpression }; 525case SyntaxKind.InvocationExpression: 529if (expression.IsKind(SyntaxKind.IdentifierName) || expression is MemberAccessExpressionSyntax) 552case SyntaxKind.ConditionalAccessExpression: 555!parentConditionalAccessExpression.Parent.IsKind(SyntaxKind.ConditionalAccessExpression); 557case SyntaxKind.IsExpression: 558case SyntaxKind.AsExpression: 562case SyntaxKind.EqualsValueClause: 563case SyntaxKind.ExpressionStatement: 564case SyntaxKind.ArrayInitializerExpression: 565case SyntaxKind.CollectionInitializerExpression: 566case SyntaxKind.Argument: 567case SyntaxKind.AttributeArgument: 568case SyntaxKind.AnonymousObjectMemberDeclarator: 569case SyntaxKind.ArrowExpressionClause: 570case SyntaxKind.AwaitExpression: 571case SyntaxKind.ReturnStatement: 572case SyntaxKind.YieldReturnStatement: 573case SyntaxKind.ParenthesizedLambdaExpression: 574case SyntaxKind.SimpleLambdaExpression: 575case SyntaxKind.ParenthesizedExpression: 576case SyntaxKind.ArrayRankSpecifier: 577case SyntaxKind.ConditionalExpression: 578case SyntaxKind.IfStatement: 579case SyntaxKind.CatchFilterClause: 580case SyntaxKind.WhileStatement: 581case SyntaxKind.DoStatement: 582case SyntaxKind.ThrowStatement: 583case SyntaxKind.SwitchStatement: 584case SyntaxKind.InterpolatedStringExpression: 585case SyntaxKind.ComplexElementInitializerExpression: 586case SyntaxKind.Interpolation: 587case SyntaxKind.RefExpression: 588case SyntaxKind.LockStatement: 589case SyntaxKind.ElementAccessExpression: 590case SyntaxKind.SwitchExpressionArm: 591case SyntaxKind.WhenClause: 598if (!(expression is LiteralExpressionSyntax && expression.IsParentKind(SyntaxKind.UnaryMinusExpression))) 639if ((expression.IsParentKind(SyntaxKind.NameEquals) && expression.Parent.IsParentKind(SyntaxKind.AttributeArgument)) || 655identifierName.Identifier.IsKindOrHasMatchingText(SyntaxKind.NameOfKeyword); 697case SyntaxKind.SimpleMemberAccessExpression: 698case SyntaxKind.ConditionalAccessExpression: 699case SyntaxKind.InvocationExpression: 700case SyntaxKind.ElementAccessExpression: 701case SyntaxKind.PostIncrementExpression: 702case SyntaxKind.PostDecrementExpression: 703case SyntaxKind.ObjectCreationExpression: 704case SyntaxKind.ImplicitObjectCreationExpression: 705case SyntaxKind.TypeOfExpression: 706case SyntaxKind.DefaultExpression: 707case SyntaxKind.CheckedExpression: 708case SyntaxKind.UncheckedExpression: 709case SyntaxKind.AnonymousMethodExpression: 710case SyntaxKind.SuppressNullableWarningExpression: 712case SyntaxKind.SizeOfExpression: 713case SyntaxKind.PointerMemberAccessExpression: 719case SyntaxKind.UnaryPlusExpression: 720case SyntaxKind.UnaryMinusExpression: 721case SyntaxKind.LogicalNotExpression: 722case SyntaxKind.BitwiseNotExpression: 723case SyntaxKind.PreIncrementExpression: 724case SyntaxKind.PreDecrementExpression: 725case SyntaxKind.CastExpression: 726case SyntaxKind.AwaitExpression: 728case SyntaxKind.PointerIndirectionExpression: 729case SyntaxKind.AddressOfExpression: 736case SyntaxKind.RangeExpression: 742case SyntaxKind.MultiplyExpression: 743case SyntaxKind.DivideExpression: 744case SyntaxKind.ModuloExpression: 750case SyntaxKind.AddExpression: 751case SyntaxKind.SubtractExpression: 757case SyntaxKind.LeftShiftExpression: 758case SyntaxKind.RightShiftExpression: 764case SyntaxKind.LessThanExpression: 765case SyntaxKind.GreaterThanExpression: 766case SyntaxKind.LessThanOrEqualExpression: 767case SyntaxKind.GreaterThanOrEqualExpression: 768case SyntaxKind.IsExpression: 769case SyntaxKind.AsExpression: 770case SyntaxKind.IsPatternExpression: 776case SyntaxKind.EqualsExpression: 777case SyntaxKind.NotEqualsExpression: 783case SyntaxKind.BitwiseAndExpression: 789case SyntaxKind.ExclusiveOrExpression: 795case SyntaxKind.BitwiseOrExpression: 801case SyntaxKind.LogicalAndExpression: 807case SyntaxKind.LogicalOrExpression: 813case SyntaxKind.CoalesceExpression: 819case SyntaxKind.ConditionalExpression: 825case SyntaxKind.SimpleAssignmentExpression: 826case SyntaxKind.MultiplyAssignmentExpression: 827case SyntaxKind.DivideAssignmentExpression: 828case SyntaxKind.ModuloAssignmentExpression: 829case SyntaxKind.AddAssignmentExpression: 830case SyntaxKind.SubtractAssignmentExpression: 831case SyntaxKind.LeftShiftAssignmentExpression: 832case SyntaxKind.RightShiftAssignmentExpression: 833case SyntaxKind.AndAssignmentExpression: 834case SyntaxKind.ExclusiveOrAssignmentExpression: 835case SyntaxKind.OrAssignmentExpression: 836case SyntaxKind.SimpleLambdaExpression: 837case SyntaxKind.ParenthesizedLambdaExpression: 843case SyntaxKind.SwitchExpression: 1091return binaryExpression.Kind() == SyntaxKind.CoalesceExpression && binaryExpression.Right == expression && HasType(binaryExpression.Left, out var leftType) ? leftType : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (2)
17.FirstOrDefault(node => node.Kind() is SyntaxKind.LocalFunctionStatement or SyntaxKind.MethodDeclaration);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (50)
32case SyntaxKind.EnumDeclaration: 34case SyntaxKind.ClassDeclaration: 36case SyntaxKind.ExtensionBlockDeclaration: 37case SyntaxKind.UnionDeclaration: 39case SyntaxKind.InterfaceDeclaration: 40case SyntaxKind.RecordDeclaration: 41case SyntaxKind.RecordStructDeclaration: 42case SyntaxKind.StructDeclaration: 44case SyntaxKind.DelegateDeclaration: 46case SyntaxKind.FieldDeclaration: 48case SyntaxKind.EventFieldDeclaration: 50case SyntaxKind.PropertyDeclaration: 52case SyntaxKind.EventDeclaration: 54case SyntaxKind.MethodDeclaration: 56case SyntaxKind.ConstructorDeclaration: 58case SyntaxKind.DestructorDeclaration: 60case SyntaxKind.IndexerDeclaration: 62case SyntaxKind.OperatorDeclaration: 77case SyntaxKind.ClassDeclaration: 79case SyntaxKind.ExtensionBlockDeclaration: 80case SyntaxKind.UnionDeclaration: 82case SyntaxKind.InterfaceDeclaration: 83case SyntaxKind.RecordDeclaration: 84case SyntaxKind.RecordStructDeclaration: 85case SyntaxKind.StructDeclaration: 87case SyntaxKind.DelegateDeclaration: 89case SyntaxKind.MethodDeclaration: 105case SyntaxKind.ClassDeclaration: 107case SyntaxKind.ExtensionBlockDeclaration: 108case SyntaxKind.UnionDeclaration: 110case SyntaxKind.InterfaceDeclaration: 111case SyntaxKind.RecordDeclaration: 112case SyntaxKind.RecordStructDeclaration: 113case SyntaxKind.StructDeclaration: 115case SyntaxKind.DelegateDeclaration: 117case SyntaxKind.MethodDeclaration: 135case SyntaxKind.DelegateDeclaration: 137case SyntaxKind.MethodDeclaration: 139case SyntaxKind.ConstructorDeclaration: 141case SyntaxKind.IndexerDeclaration: 143case SyntaxKind.OperatorDeclaration: 145case SyntaxKind.ConversionOperatorDeclaration: 159case SyntaxKind.DelegateDeclaration: 161case SyntaxKind.MethodDeclaration: 163case SyntaxKind.OperatorDeclaration: 165case SyntaxKind.PropertyDeclaration: 167case SyntaxKind.IndexerDeclaration: 169case SyntaxKind.EventDeclaration: 171case SyntaxKind.EventFieldDeclaration: 173case SyntaxKind.FieldDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.DeclarationFinder.cs (1)
32if (syntaxToken.Kind() == SyntaxKind.IdentifierToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (75)
38var parentExpression = nodeParent.IsKind(SyntaxKind.ConstantPattern) 57if (expression.IsKind(SyntaxKind.ParenthesizedExpression) || 58parentExpression.IsKind(SyntaxKind.ParenthesizedExpression)) 84if (expression.Kind() is SyntaxKind.GreaterThanExpression or SyntaxKind.LessThanExpression && 87var opposite = expression.IsKind(SyntaxKind.GreaterThanExpression) ? SyntaxKind.LessThanExpression : SyntaxKind.GreaterThanExpression; 93if (expression.IsKind(SyntaxKind.ThrowExpression)) 97if (nodeParent.IsKind(SyntaxKind.ExpressionStatement)) 101if (nodeParent.IsKind(SyntaxKind.ArrowExpressionClause)) 105if (nodeParent.Kind() is SyntaxKind.CheckedExpression or SyntaxKind.UncheckedExpression) 109if (expression.IsKind(SyntaxKind.TupleExpression)) 117if (tokenAfterParen.Kind() == SyntaxKind.OpenBracketToken) 170(nodeParent is YieldStatementSyntax(SyntaxKind.YieldReturnStatement) yieldStatement && yieldStatement.Expression == node) || 195if (nodeParent.IsKind(SyntaxKind.CastExpression) && expression.IsKind(SyntaxKind.ThisExpression)) 205if (nodeParent.IsKind(SyntaxKind.Interpolation)) 210if (expression.IsKind(SyntaxKind.InterpolatedStringExpression)) 257if (expression.IsKind(SyntaxKind.ThisExpression)) 271if (expression.IsKind(SyntaxKind.ThrowExpression) && 272nodeParent is BinaryExpressionSyntax(SyntaxKind.CoalesceExpression) binary && 279if (nodeParent.IsKind(SyntaxKind.CaseSwitchLabel)) 283if (nodeParent.IsKind(SyntaxKind.ConstantPattern) && 284nodeParent.IsParentKind(SyntaxKind.CasePatternSwitchLabel)) 290if (nodeParent.IsKind(SyntaxKind.WhenClause)) 318if (parentExpression.IsKind(SyntaxKind.CastExpression) && 319expression.Kind() is SyntaxKind.PreIncrementExpression or SyntaxKind.PreDecrementExpression) 326if (expression.IsKind(SyntaxKind.ConditionalExpression) && 337if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 389if (ancestor.IsKind(SyntaxKind.ParenthesizedExpression)) 392if (ancestor.IsKind(SyntaxKind.Interpolation, out interpolation)) 414if (!childNode.IsKind(SyntaxKind.ParenthesizedExpression)) 419if (nodeOrToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.ColonColonToken) 488if (parentExpression.IsKind(SyntaxKind.CoalesceExpression)) 510private static bool IsAssociative(SyntaxKind kind) 514case SyntaxKind.AddExpression: 515case SyntaxKind.MultiplyExpression: 516case SyntaxKind.BitwiseOrExpression: 517case SyntaxKind.ExclusiveOrExpression: 518case SyntaxKind.LogicalOrExpression: 519case SyntaxKind.BitwiseAndExpression: 520case SyntaxKind.LogicalAndExpression: 551SyntaxKind.PredefinedType or 552SyntaxKind.ArrayType or 553SyntaxKind.PointerType or 554SyntaxKind.NullableType) 567SyntaxKind.UnaryMinusExpression or 568SyntaxKind.UnaryPlusExpression or 569SyntaxKind.PointerIndirectionExpression or 570SyntaxKind.AddressOfExpression) 581if (name.IsKind(SyntaxKind.AliasQualifiedName)) 607binaryExpression.Kind() is SyntaxKind.LessThanExpression or SyntaxKind.GreaterThanExpression && 608(binaryExpression.IsParentKind(SyntaxKind.Argument) || binaryExpression.Parent is InitializerExpressionSyntax)) 610if (binaryExpression.IsKind(SyntaxKind.LessThanExpression)) 623else if (binaryExpression.IsKind(SyntaxKind.GreaterThanExpression)) 626binaryExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression) 638else if (node.Expression.IsKind(SyntaxKind.LessThanExpression)) 645else if (node.Expression.IsKind(SyntaxKind.GreaterThanExpression)) 681previousExpression is not BinaryExpressionSyntax(SyntaxKind.LessThanExpression) lessThanExpression) 687|| lessThanExpression.Left.IsKind(SyntaxKind.CastExpression)) 716nextExpression is not BinaryExpressionSyntax(SyntaxKind.GreaterThanExpression) greaterThanExpression) 722&& greaterThanExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression; 726=> expression.Kind() is SyntaxKind.IdentifierName or SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression; 818if (binaryPattern.IsKind(SyntaxKind.AndPattern)) 821if (binaryPattern.IsKind(SyntaxKind.OrPattern))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (31)
63case SyntaxKind.SimpleMemberAccessExpression: 64case SyntaxKind.PointerMemberAccessExpression: 70case SyntaxKind.QualifiedName: 76case SyntaxKind.AliasQualifiedName: 82case SyntaxKind.GenericName: 88case SyntaxKind.IdentifierName: 153case SyntaxKind.CommaToken: 154case SyntaxKind.DelegateKeyword: 225variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 232if (type.IsParentKind(SyntaxKind.ObjectCreationExpression) && 233type.Parent.IsParentKind(SyntaxKind.EqualsValueClause) && 234type.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclarator) && 235type.Parent.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 236variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 252is SyntaxKind.DelegateDeclaration 253or SyntaxKind.MethodDeclaration 254or SyntaxKind.PropertyDeclaration 255or SyntaxKind.EventDeclaration 256or SyntaxKind.IndexerDeclaration 257or SyntaxKind.OperatorDeclaration) 273if (type.IsParentKind(SyntaxKind.Parameter) && type.Parent.IsParentKind(SyntaxKind.ParameterList)) 276is SyntaxKind.DelegateDeclaration 277or SyntaxKind.MethodDeclaration 278or SyntaxKind.IndexerDeclaration 279or SyntaxKind.OperatorDeclaration) 285if (type.Parent.Parent.IsParentKind(SyntaxKind.ConstructorDeclaration)) 296if (type.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 297variableDeclaration.IsParentKind(SyntaxKind.EventFieldDeclaration)) 307if (type.IsParentKind(SyntaxKind.TypeConstraint)) 447if (SyntaxFacts.GetContextualKeywordKind(parameter.Name) is not SyntaxKind.UnderscoreToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SimpleNameSyntaxExtensions.cs (1)
16Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.IsParentKind(SyntaxKind.NameMemberCref));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (2)
40if (first.Parent.IsKind(SyntaxKind.GlobalStatement)) 41return second.Parent.IsKind(SyntaxKind.GlobalStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SymbolDisplayPartExtensions.cs (1)
21if (SyntaxFacts.GetKeywordKind(text) != SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxKindExtensions.cs (29)
14/// Determine if the given <see cref="SyntaxKind"/> array contains the given kind. 22public static bool Contains(this SyntaxKind[] kinds, SyntaxKind kind) 24foreach (var k in kinds) 35public static SyntaxKind MapCompoundAssignmentKindToBinaryExpressionKind(this SyntaxKind syntaxKind) 39case SyntaxKind.AddAssignmentExpression: 40return SyntaxKind.AddExpression; 42case SyntaxKind.SubtractAssignmentExpression: 43return SyntaxKind.SubtractExpression; 45case SyntaxKind.MultiplyAssignmentExpression: 46return SyntaxKind.MultiplyExpression; 48case SyntaxKind.DivideAssignmentExpression: 49return SyntaxKind.DivideExpression; 51case SyntaxKind.ModuloAssignmentExpression: 52return SyntaxKind.ModuloExpression; 54case SyntaxKind.AndAssignmentExpression: 55return SyntaxKind.BitwiseAndExpression; 57case SyntaxKind.ExclusiveOrAssignmentExpression: 58return SyntaxKind.ExclusiveOrExpression; 60case SyntaxKind.OrAssignmentExpression: 61return SyntaxKind.BitwiseOrExpression; 63case SyntaxKind.LeftShiftAssignmentExpression: 64return SyntaxKind.LeftShiftExpression; 66case SyntaxKind.RightShiftAssignmentExpression: 67return SyntaxKind.RightShiftExpression; 69case SyntaxKind.CoalesceAssignmentExpression: 70return SyntaxKind.CoalesceExpression; 74return SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (57)
28public static void Deconstruct(this SyntaxNode node, out SyntaxKind kind) 31public static bool IsKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 44public static bool IsParentKind([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind) 47public static bool IsParentKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 75if (prevToken.Kind() == SyntaxKind.None) 93is SyntaxKind.ArgumentList 94or SyntaxKind.AttributeArgumentList 95or SyntaxKind.BracketedArgumentList 96or SyntaxKind.TypeArgumentList; 186if ((current?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == current) || 196SyntaxKind.InvocationExpression or 197SyntaxKind.ElementAccessExpression or 198SyntaxKind.SimpleMemberAccessExpression or 199SyntaxKind.MemberBindingExpression or 200SyntaxKind.ElementBindingExpression or 202SyntaxKind.SuppressNullableWarningExpression) && 285=> node is AssignmentExpressionSyntax(kind: not SyntaxKind.SimpleAssignmentExpression); 288=> node?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment && 332m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword)); 345case LocalFunctionStatementSyntax localFunction when localFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 348case AnonymousFunctionExpressionSyntax anonymousFunction when anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 352return current.GetModifiers().Any(SyntaxKind.StaticKeyword); 355return property.Modifiers.Any(SyntaxKind.StaticKeyword) || 360return !current.Parent.IsKind(SyntaxKind.CompilationUnit); 399case SyntaxKind.DoStatement: 400case SyntaxKind.WhileStatement: 401case SyntaxKind.SwitchStatement: 402case SyntaxKind.ForStatement: 403case SyntaxKind.ForEachStatement: 404case SyntaxKind.ForEachVariableStatement: 415case SyntaxKind.DoStatement: 416case SyntaxKind.WhileStatement: 417case SyntaxKind.ForStatement: 418case SyntaxKind.ForEachStatement: 419case SyntaxKind.ForEachVariableStatement: 430case SyntaxKind.AnonymousMethodExpression: 431case SyntaxKind.SimpleLambdaExpression: 432case SyntaxKind.ParenthesizedLambdaExpression: 433case SyntaxKind.LocalFunctionStatement: 434case SyntaxKind.MethodDeclaration: 435case SyntaxKind.ConstructorDeclaration: 436case SyntaxKind.DestructorDeclaration: 437case SyntaxKind.GetAccessorDeclaration: 438case SyntaxKind.SetAccessorDeclaration: 439case SyntaxKind.InitAccessorDeclaration: 440case SyntaxKind.OperatorDeclaration: 441case SyntaxKind.ConversionOperatorDeclaration: 442case SyntaxKind.AddAccessorDeclaration: 443case SyntaxKind.RemoveAccessorDeclaration: 454=> node.IsReturnableConstruct() || (node is CompilationUnitSyntax compilationUnit && compilationUnit.Members.Any(SyntaxKind.GlobalStatement)); 556if (trivia.GetStructure() is (kind: SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia or SyntaxKind.IfDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia)) 570else if (trivia.GetStructure() is (kind: SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia)) 898while (finalTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)])
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
60if (token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (88)
20public static void Deconstruct(this SyntaxToken token, out SyntaxKind kind) 39public static bool IsKindOrHasMatchingText(this SyntaxToken token, SyntaxKind kind) 42public static bool HasMatchingText(this SyntaxToken token, SyntaxKind kind) 46=> token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 47token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression); 50=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList); 64if (token.Kind() == SyntaxKind.IdentifierToken) 69SyntaxFacts.GetContextualKeywordKind(simpleNameText) != SyntaxKind.None; 75public static bool IsPotentialModifier(this SyntaxToken token, out SyntaxKind modifierKind) 77var tokenKind = token.Kind(); 78modifierKind = SyntaxKind.None; 82case SyntaxKind.PublicKeyword: 83case SyntaxKind.InternalKeyword: 84case SyntaxKind.ProtectedKeyword: 85case SyntaxKind.PrivateKeyword: 86case SyntaxKind.SealedKeyword: 87case SyntaxKind.AbstractKeyword: 89case SyntaxKind.ClosedKeyword: 91case SyntaxKind.StaticKeyword: 92case SyntaxKind.VirtualKeyword: 93case SyntaxKind.ExternKeyword: 94case SyntaxKind.NewKeyword: 95case SyntaxKind.OverrideKeyword: 96case SyntaxKind.ReadOnlyKeyword: 97case SyntaxKind.VolatileKeyword: 98case SyntaxKind.UnsafeKeyword: 99case SyntaxKind.AsyncKeyword: 100case SyntaxKind.RefKeyword: 101case SyntaxKind.OutKeyword: 102case SyntaxKind.InKeyword: 103case SyntaxKind.RequiredKeyword: 104case SyntaxKind.FileKeyword: 105case SyntaxKind.PartialKeyword: 108case SyntaxKind.IdentifierToken: 109if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 111modifierKind = SyntaxKind.AsyncKeyword; 113if (token.HasMatchingText(SyntaxKind.FileKeyword)) 115modifierKind = SyntaxKind.FileKeyword; 118if (token.HasMatchingText(SyntaxKind.ClosedKeyword)) 120modifierKind = SyntaxKind.ClosedKeyword; 123if (token.HasMatchingText(SyntaxKind.PartialKeyword)) 125modifierKind = SyntaxKind.PartialKeyword; 127return modifierKind != SyntaxKind.None; 137case SyntaxKind.CharacterLiteralToken: 138case SyntaxKind.FalseKeyword: 139case SyntaxKind.NumericLiteralToken: 140case SyntaxKind.StringLiteralToken: 141case SyntaxKind.TrueKeyword: 171if (previousToken.Kind() == SyntaxKind.None) 204=> token.Kind() == SyntaxKind.StringLiteralToken && !token.IsVerbatimStringLiteral(); 210case SyntaxKind.AssemblyKeyword: 211case SyntaxKind.ModuleKeyword: 212case SyntaxKind.FieldKeyword: 213case SyntaxKind.EventKeyword: 214case SyntaxKind.MethodKeyword: 215case SyntaxKind.ParamKeyword: 216case SyntaxKind.PropertyKeyword: 217case SyntaxKind.ReturnKeyword: 218case SyntaxKind.TypeKeyword: 242if (genericIdentifier.GetNextToken(includeSkipped: true).Kind() == SyntaxKind.LessThanToken) 266Contract.ThrowIfFalse(genericIdentifier.Kind() == SyntaxKind.IdentifierToken); 270Contract.ThrowIfFalse(token.Kind() == SyntaxKind.LessThanToken); 279if (next.Kind() == SyntaxKind.None) 287if (token.Kind() == SyntaxKind.GreaterThanToken) 302case SyntaxKind.LessThanLessThanToken: 304goto case SyntaxKind.LessThanToken; 307case SyntaxKind.LessThanToken: 311case SyntaxKind.AsteriskToken: // for int* 312case SyntaxKind.QuestionToken: // for int? 313case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 314case SyntaxKind.ColonColonToken: // for global:: 315case SyntaxKind.CloseBracketToken: 316case SyntaxKind.OpenBracketToken: 317case SyntaxKind.DotToken: 318case SyntaxKind.IdentifierToken: 319case SyntaxKind.CommaToken: 323case SyntaxKind.ClassKeyword: 324case SyntaxKind.StructKeyword: 325case SyntaxKind.InterfaceKeyword: 326case SyntaxKind.DelegateKeyword: 327case SyntaxKind.EnumKeyword: 328case SyntaxKind.PrivateKeyword: 329case SyntaxKind.PublicKeyword: 330case SyntaxKind.InternalKeyword: 331case SyntaxKind.ProtectedKeyword: 332case SyntaxKind.VoidKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (54)
17public static ISet<SyntaxKind> GetPrecedingModifiers(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 20public static ISet<SyntaxKind> GetPrecedingModifiers( 30var result = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer); 31while (token.IsPotentialModifier(out var modifierKind)) 87private static readonly Func<SyntaxKind, bool> s_isDot = k => k is SyntaxKind.DotToken; 88private static readonly Func<SyntaxKind, bool> s_isDotOrArrow = k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken; 89private static readonly Func<SyntaxKind, bool> s_isDotOrArrowOrColonColon = 90k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken or SyntaxKind.ColonColonToken; 95(targetToken.IsKind(SyntaxKind.DotDotToken) && position == targetToken.SpanStart + 1) || 106this SyntaxTree syntaxTree, int position, Func<SyntaxKind, bool> predicate, CancellationToken cancellationToken) 111if (token.Kind() == SyntaxKind.None) 122return token.Kind() == SyntaxKind.NumericLiteralToken; 125public static bool IsAfterKeyword(this SyntaxTree syntaxTree, int position, SyntaxKind kind, CancellationToken cancellationToken) 202var endsWithNewLine = trivia.GetStructure()!.GetLastToken(includeSkipped: true).Kind() == SyntaxKind.XmlTextLiteralNewLineToken; 263if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 269return trivia.Kind() == SyntaxKind.ConflictMarkerTrivia; 277if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 303if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 324var kind = token.Kind(); 326SyntaxKind.StringLiteralToken or 327SyntaxKind.CharacterLiteralToken or 328SyntaxKind.SingleLineRawStringLiteralToken or 329SyntaxKind.MultiLineRawStringLiteralToken or 330SyntaxKind.Utf8StringLiteralToken or 331SyntaxKind.Utf8SingleLineRawStringLiteralToken or 332SyntaxKind.Utf8MultiLineRawStringLiteralToken)) 339SyntaxKind.Utf8StringLiteralToken or 340SyntaxKind.Utf8SingleLineRawStringLiteralToken or 341SyntaxKind.Utf8MultiLineRawStringLiteralToken) 349if (kind is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken) 399if (token.Kind() is SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken) 404SyntaxKind.StringLiteralToken or 405SyntaxKind.SingleLineRawStringLiteralToken or 406SyntaxKind.MultiLineRawStringLiteralToken or 407SyntaxKind.Utf8StringLiteralToken or 408SyntaxKind.Utf8SingleLineRawStringLiteralToken or 409SyntaxKind.Utf8MultiLineRawStringLiteralToken) 421SyntaxKind.InterpolatedStringStartToken or 422SyntaxKind.InterpolatedStringEndToken or 423SyntaxKind.InterpolatedRawStringEndToken or 424SyntaxKind.InterpolatedSingleLineRawStringStartToken or 425SyntaxKind.InterpolatedMultiLineRawStringStartToken) 430if (token.Kind() is SyntaxKind.InterpolatedStringTextToken) 455if (token.Kind() == SyntaxKind.CharacterLiteralToken) 497if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 503if (token.Kind() == SyntaxKind.EndOfFileToken) 553if (token.IsKind(SyntaxKind.HashToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (15)
21public static void Deconstruct(this SyntaxTrivia trivia, out SyntaxKind kind) 25=> trivia.Kind() is SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineCommentTrivia; 37=> trivia.Kind() == SyntaxKind.SingleLineCommentTrivia; 40=> trivia.Kind() == SyntaxKind.MultiLineCommentTrivia; 43=> trivia.Kind() == SyntaxKind.ShebangDirectiveTrivia; 47if (trivia.Kind() != SyntaxKind.MultiLineCommentTrivia) 58=> trivia.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia; 61=> trivia.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia; 66if (trivia.Kind() == SyntaxKind.SingleLineCommentTrivia) 75else if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 148=> trivia.Kind() == SyntaxKind.EndOfLineTrivia; 151=> trivia.Kind() == SyntaxKind.WhitespaceTrivia; 203if (trivia.IsKind(SyntaxKind.PragmaWarningDirectiveTrivia)) 206isDisable = pragmaWarning.DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (8)
21.Where(t => t.Kind() == SyntaxKind.EndOfLineTrivia) 38.Where(t => t is (kind: SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.WhitespaceTrivia)) 43=> triviaList.SkipWhile(t => t.Kind() == SyntaxKind.WhitespaceTrivia); 52if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 55t.Kind() is SyntaxKind.EndOfLineTrivia or 56SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
15predefinedType.Keyword.IsKind(SyntaxKind.VoidKeyword); 20((IdentifierNameSyntax)typeSyntax).Identifier.IsKind(SyntaxKind.PartialKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\DefaultOperationProvider.cs (1)
45var space = currentToken.Kind() == SyntaxKind.EndOfFileToken ? 0 : 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (16)
37=> trivia.RawKind == (int)SyntaxKind.WhitespaceTrivia; 40=> trivia.RawKind == (int)SyntaxKind.EndOfLineTrivia; 69if (trivia2.IsKind(SyntaxKind.None)) 90if (trivia2.IsKind(SyntaxKind.BadDirectiveTrivia) && existingWhitespaceBetween.Lines == 0 && !implicitLineBreak) 97var lines = (trivia1.IsKind(SyntaxKind.None) && this.Token1.IsKind(SyntaxKind.None)) ? 0 : 1; 99if (trivia2.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia) 110if (previous.IsKind(SyntaxKind.DisabledTextTrivia)) 114else if (previous.IsKind(SyntaxKind.EndIfDirectiveTrivia)) 178if (trivia2.IsKind(SyntaxKind.SkippedTokensTrivia)) 198structuredTrivia.GetTrailingTrivia().Any(SyntaxKind.EndOfLineTrivia); 210var isAtEndOfFileToken = (Token2.IsKind(SyntaxKind.EndOfFileToken) && trivia2.Kind() == 0); 220if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 334if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 363if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (3)
34if (trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia) 71if (currentParent.Kind() is SyntaxKind.SingleLineDocumentationCommentTrivia or 72SyntaxKind.MultiLineDocumentationCommentTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (9)
66for (var currentToken = token1; !currentToken.IsKind(SyntaxKind.None);) 76if (previousToken.TrailingTrivia is [.., (kind: SyntaxKind.EndOfLineTrivia)]) 101if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 105else if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 113else if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 117else if (trivia.Kind() is SyntaxKind.DisabledTextTrivia or 118SyntaxKind.PreprocessingMessageTrivia) 122else if (trivia.Kind() == SyntaxKind.ConflictMarkerTrivia) 155Debug.Assert(trivia.Kind() == SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (18)
36Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.EndOfLineTrivia); 37Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.SkippedTokensTrivia); 38Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia); 46if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 63if (trivia.Kind() == SyntaxKind.RegionDirectiveTrivia || 64trivia.Kind() == SyntaxKind.EndRegionDirectiveTrivia || 78if (trivia.Kind() is SyntaxKind.SkippedTokensTrivia or 79SyntaxKind.PreprocessingMessageTrivia) 125if (trivia.Kind() != SyntaxKind.WhitespaceTrivia) 154if (trivia.Kind() != SyntaxKind.EndOfLineTrivia) 213if (trivia.Kind() is not SyntaxKind.SkippedTokensTrivia and 214not SyntaxKind.PreprocessingMessageTrivia) 224if (trivia.Kind() is not SyntaxKind.RegionDirectiveTrivia and 225not SyntaxKind.EndRegionDirectiveTrivia) 269trivia.Kind() == SyntaxKind.WhitespaceTrivia || 270trivia.Kind() == SyntaxKind.EndOfLineTrivia) 309if (trivia.IsKind(SyntaxKind.DisabledTextTrivia)) 332if (xmlTrivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (2)
53var formatSpanEnd = commonToken2.Kind() == SyntaxKind.None ? commonToken1.Span.End : commonToken2.Span.Start; 81var firstTriviaInTree = this.Token1.Kind() == SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (1)
119if (trivia.Kind() == SyntaxKind.EndOfLineTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (95)
57if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.None) || 59bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.None)) 64if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBraceToken)) 66return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBraceToken); 69if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBracketToken)) 71return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBracketToken); 78=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.ConversionOperatorDeclaration); 81=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.OperatorDeclaration); 84=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 87=> token.Kind() == SyntaxKind.CloseParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 91return token.Kind() == SyntaxKind.OpenParenToken && 97return token.Kind() == SyntaxKind.CloseParenToken && 104if (token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList)) 110if (token.Parent.IsKind(SyntaxKind.PositionalPatternClause) && token.Parent.Parent.IsKind(SyntaxKind.RecursivePattern)) 120=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.BaseList); 123=> token.Kind() == SyntaxKind.CommaToken && (token.Parent.IsAnyArgumentList() || token.Parent?.Kind() is SyntaxKind.ParameterList or SyntaxKind.FunctionPointerParameterList); 126=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList) && token.Parent.Parent.IsKind(SyntaxKind.ParenthesizedLambdaExpression); 130if (node.Kind() != SyntaxKind.Block) 135return node.Parent?.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression; 140if (node.Kind() != SyntaxKind.Block) 145return node.IsParentKind(SyntaxKind.AnonymousMethodExpression); 151token.Kind() == SyntaxKind.SemicolonToken && 158if (token.Kind() != SyntaxKind.SemicolonToken) 174if (token.Kind() != SyntaxKind.CloseBraceToken) 179return token.Parent is ExpressionSyntax || token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 184if (token.Kind() != SyntaxKind.CloseBraceToken) 210return token.Kind() == SyntaxKind.CommaToken && 211token.Parent.IsKind(SyntaxKind.EnumDeclaration); 216return token.Kind() == SyntaxKind.CommaToken && 222return token.Kind() == SyntaxKind.CommaToken && 223token.Parent.IsKind(SyntaxKind.VariableDeclaration); 237case SyntaxKind.SizeOfExpression: 241case SyntaxKind.TypeOfExpression: 245case SyntaxKind.CheckedExpression: 246case SyntaxKind.UncheckedExpression: 250case SyntaxKind.DefaultExpression: 254case SyntaxKind.MakeRefExpression: 258case SyntaxKind.RefTypeExpression: 262case SyntaxKind.RefValueExpression: 266case SyntaxKind.ArgumentList: 270case SyntaxKind.AttributeArgumentList: 280return token.IsKind(SyntaxKind.EqualsToken) && 281token.Parent.IsKind(SyntaxKind.EqualsValueClause) && 282token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration); 308=> token.IsDotInMemberAccess() || (token.Kind() == SyntaxKind.DotToken && token.Parent.IsKind(SyntaxKind.QualifiedName)); 317return token.Kind() == SyntaxKind.DotToken 323if (token.Kind() == SyntaxKind.GreaterThanToken) 324return token.Parent is (kind: SyntaxKind.TypeParameterList or SyntaxKind.TypeArgumentList); 331return token.Kind() == SyntaxKind.CommaToken && 337=> token.Kind() == SyntaxKind.ColonToken && token.Parent is CasePatternSwitchLabelSyntax; 340=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.SwitchExpressionArm); 343=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.SwitchExpression); 346=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 350return token.Kind() == SyntaxKind.IdentifierToken && 360return token.Kind() == SyntaxKind.ColonToken && 377=> token.Kind() == SyntaxKind.InKeyword && token.Parent is FromClauseSyntax { Expression: QueryExpressionSyntax }; 381return token.Kind() == SyntaxKind.FromKeyword && 404if (expression.Kind() == SyntaxKind.SimpleAssignmentExpression) 432parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 451parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 466return (token1.Kind() == SyntaxKind.OpenParenToken && token2.Kind() == SyntaxKind.CloseParenToken) || 467(token1.Kind() == SyntaxKind.OpenBracketToken && token2.Kind() == SyntaxKind.CloseBracketToken); 472if (token.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 511if (token.Kind() is not SyntaxKind.PlusToken and not SyntaxKind.MinusToken) 520=> currentToken.Parent.IsKind(SyntaxKind.Interpolation); 527return currentToken.Kind() == SyntaxKind.OpenParenToken && currentToken is { Parent: ParenthesizedVariableDesignationSyntax, Parent.Parent: DeclarationExpressionSyntax }; 535return currentToken.IsKind(SyntaxKind.CommaToken) && 536currentToken.Parent.IsKind(SyntaxKind.TupleExpression); 541return currentToken.IsKind(SyntaxKind.CommaToken) && 542currentToken.Parent.IsKind(SyntaxKind.TupleType); 547return currentToken.IsKind(SyntaxKind.CommaToken) && 548currentToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation); 552=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.CollectionExpression); 559return !previousToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) && !currentToken.LeadingTrivia.Any(SyntaxKind.EndOfLineTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (3)
20if (node.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression) 26if (node.IsKind(SyntaxKind.AnonymousMethodExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (15)
24if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 37if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 51if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 65if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 80if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 116if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 126if (anchorToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 172else if (node.IsKind(SyntaxKind.PropertyPatternClause))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (62)
115currentToken.IsKind(SyntaxKind.WhereKeyword) && 116currentToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 130firstTokenAfterTypeConstraint.IsKind(SyntaxKind.WhereKeyword) && 131firstTokenAfterTypeConstraint.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 142currentToken.IsKind(SyntaxKind.OpenBraceToken) && 143currentToken.Parent.IsParentKind(SyntaxKind.IfStatement)) 176if (previousToken.Kind() != SyntaxKind.SemicolonToken) 179if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 182if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 216if (previousMember.Kind() is SyntaxKind.FieldDeclaration or 217SyntaxKind.EventFieldDeclaration) 293if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 310if (currentToken.Kind() == SyntaxKind.None) 317case SyntaxKind.None: 320case SyntaxKind.OpenBraceToken: 321case SyntaxKind.FinallyKeyword: 324case SyntaxKind.CloseBraceToken: 327case SyntaxKind.CloseParenToken: 329|| currentToken.Kind() == SyntaxKind.OpenBraceToken) ? 1 : 0; 331case SyntaxKind.CloseBracketToken: 337(parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.AssemblyKeyword) || 338parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.ModuleKeyword))) 340if (!currentToken.IsKind(SyntaxKind.EndOfFileToken) && !(currentToken.Parent is AttributeListSyntax)) 355case SyntaxKind.SemicolonToken: 358case SyntaxKind.CommaToken: 361case SyntaxKind.ElseKeyword: 362return currentToken.Kind() != SyntaxKind.IfKeyword ? 1 : 0; 364case SyntaxKind.ColonToken: 373if ((currentToken.Kind() == SyntaxKind.FromKeyword && currentToken.Parent.IsKind(SyntaxKind.FromClause)) || 374(currentToken.Kind() == SyntaxKind.LetKeyword && currentToken.Parent.IsKind(SyntaxKind.LetClause)) || 375(currentToken.Kind() == SyntaxKind.WhereKeyword && currentToken.Parent.IsKind(SyntaxKind.WhereClause)) || 376(currentToken.Kind() == SyntaxKind.JoinKeyword && currentToken.Parent.IsKind(SyntaxKind.JoinClause)) || 377(currentToken.Kind() == SyntaxKind.JoinKeyword && currentToken.Parent.IsKind(SyntaxKind.JoinIntoClause)) || 378(currentToken.Kind() == SyntaxKind.OrderByKeyword && currentToken.Parent.IsKind(SyntaxKind.OrderByClause)) || 379(currentToken.Kind() == SyntaxKind.SelectKeyword && currentToken.Parent.IsKind(SyntaxKind.SelectClause)) || 380(currentToken.Kind() == SyntaxKind.GroupKeyword && currentToken.Parent.IsKind(SyntaxKind.GroupClause))) 387case SyntaxKind.OpenBraceToken: 388case SyntaxKind.CloseBraceToken: 389case SyntaxKind.ElseKeyword: 390case SyntaxKind.FinallyKeyword: 393case SyntaxKind.OpenBracketToken: 399parent.Target.Identifier.Kind() is SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword && 416case SyntaxKind.WhereKeyword: 425if (nextToken.Kind() == SyntaxKind.CloseBraceToken) 430nextToken.Kind() is SyntaxKind.CatchKeyword or 431SyntaxKind.FinallyKeyword or 432SyntaxKind.ElseKeyword) 437nextToken.Kind() == SyntaxKind.WhileKeyword && 438nextToken.Parent.IsKind(SyntaxKind.DoStatement)) 442else if (nextToken.Kind() == SyntaxKind.EndOfFileToken) 458else if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 482return trivia.Kind() is SyntaxKind.WhitespaceTrivia 483or SyntaxKind.EndOfLineTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\EndOfFileTokenFormattingRule.cs (2)
17if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 29if (currentToken.Kind() == SyntaxKind.EndOfFileToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (7)
95var firstStatementIsBlock = section.Statements is [(kind: SyntaxKind.Block), ..]; 222if (node.IsLambdaBodyBlock() || node.IsAnonymousMethodBlock() || node.Kind() is SyntaxKind.PropertyPatternClause or SyntaxKind.SwitchExpression) 228if (node.IsKind(SyntaxKind.ArrayInitializerExpression) && node.Parent != null && node.Parent.IsKind(SyntaxKind.ArrayCreationExpression)) 262if (node.Parent != null && node.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (79)
44if (node.IsKind(SyntaxKind.SwitchStatement)) 53case SyntaxKind.IfStatement: 54case SyntaxKind.ElseClause: 55case SyntaxKind.WhileStatement: 56case SyntaxKind.DoStatement: 57case SyntaxKind.ForEachStatement: 58case SyntaxKind.ForEachVariableStatement: 59case SyntaxKind.UsingStatement: 60case SyntaxKind.ForStatement: 61case SyntaxKind.TryStatement: 62case SyntaxKind.CatchClause: 63case SyntaxKind.FinallyClause: 64case SyntaxKind.LockStatement: 65case SyntaxKind.CheckedStatement: 66case SyntaxKind.UncheckedStatement: 67case SyntaxKind.SwitchSection: 68case SyntaxKind.FixedStatement: 69case SyntaxKind.UnsafeStatement: 83if (previousToken.IsKind(SyntaxKind.CloseBraceToken) 84&& currentToken.IsKind(SyntaxKind.ElseKeyword) 94if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 103if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 112if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 121if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 130if (currentToken.IsKind(SyntaxKind.OpenBraceToken)) 132if (currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression 133or SyntaxKind.CollectionInitializerExpression 134or SyntaxKind.ArrayInitializerExpression 135or SyntaxKind.ImplicitArrayCreationExpression 136or SyntaxKind.WithInitializerExpression) 143else if (currentToken.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 153var isFirstTokenOfSwitchArm = currentToken.Parent.IsParentKind(SyntaxKind.RecursivePattern, out RecursivePatternSyntax? recursivePattern) 154&& recursivePattern.IsParentKind(SyntaxKind.SwitchExpressionArm, out SwitchExpressionArmSyntax? switchExpressionArm) 170if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 183if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 192if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 201if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 210if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 211currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 220if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 229if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 249if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression)) 263if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 277if (previousToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.IsKind(SyntaxKind.ElseKeyword)) 291if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 304if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 317if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 330if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 346if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 347currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression or SyntaxKind.WithInitializerExpression or SyntaxKind.PropertyPatternClause) 363if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 364currentToken.Parent.Kind() is SyntaxKind.ArrayInitializerExpression or SyntaxKind.ImplicitArrayCreationExpression) 374if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 392if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 405if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 418if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 431if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 432currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 445if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 458if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 473if (previousToken.IsKind(SyntaxKind.SemicolonToken) 474&& (previousToken.Parent is StatementSyntax && !previousToken.Parent.IsKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\QueryExpressionFormattingRule.cs (7)
169case SyntaxKind.FromKeyword: 170case SyntaxKind.WhereKeyword: 171case SyntaxKind.LetKeyword: 172case SyntaxKind.JoinKeyword: 173case SyntaxKind.OrderByKeyword: 174case SyntaxKind.GroupKeyword: 175case SyntaxKind.SelectKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (165)
47var previousKind = previousToken.Kind(); 48var currentKind = currentToken.Kind(); 49var previousParentKind = previousToken.Parent.Kind(); 50var currentParentKind = currentToken.Parent.Kind(); 53if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.IdentifierToken) 65if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.GreaterThanToken) 68if (currentToken.IsOpenParenInParameterListOfParenthesizedLambdaExpression() && previousParentKind == SyntaxKind.TypeArgumentList) 73if (previousParentKind == SyntaxKind.TypeParameterList) 85if ((previousToken.IsKeyword() || previousToken.Kind() is SyntaxKind.QuestionToken or SyntaxKind.AsteriskToken or SyntaxKind.CloseBracketToken or SyntaxKind.CloseParenToken or SyntaxKind.GreaterThanToken) 92if (previousToken.Parent.IsKind(SyntaxKind.OperatorDeclaration) && currentToken.IsOpenParenInParameterListOfAOperationDeclaration()) 137if (currentKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 142if (previousKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(previousParentKind)) 147if (currentKind == SyntaxKind.CloseParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 153if (currentKind == SyntaxKind.OpenParenToken && 154(previousKind == SyntaxKind.IfKeyword || previousKind == SyntaxKind.WhileKeyword || previousKind == SyntaxKind.SwitchKeyword || 155previousKind == SyntaxKind.ForKeyword || previousKind == SyntaxKind.ForEachKeyword || previousKind == SyntaxKind.CatchKeyword || 156previousKind == SyntaxKind.UsingKeyword || previousKind == SyntaxKind.WhenKeyword || previousKind == SyntaxKind.LockKeyword || 157previousKind == SyntaxKind.FixedKeyword)) 163if ((previousToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && previousKind == SyntaxKind.OpenParenToken) || 164(currentToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && currentKind == SyntaxKind.CloseParenToken)) 170if ((previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.OpenParenToken) || 171(currentParentKind == SyntaxKind.CastExpression && currentKind == SyntaxKind.CloseParenToken)) 177if (previousParentKind == SyntaxKind.ForStatement 180if (currentKind == SyntaxKind.SemicolonToken 181&& (previousKind != SyntaxKind.SemicolonToken 191if (previousKind == SyntaxKind.OpenParenToken && IsControlFlowLikeKeywordStatementKind(previousParentKind)) 196if (currentKind == SyntaxKind.CloseParenToken && IsControlFlowLikeKeywordStatementKind(currentParentKind)) 202if (previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.CloseParenToken) 208if (currentKind == SyntaxKind.OpenBracketToken && currentToken.Parent.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression) 211if (previousKind == SyntaxKind.CommaToken) 217if (previousKind is not (SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken)) 224if (currentKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(currentToken) && !previousToken.IsOpenBraceOrCommaOfObjectInitializer()) 230if (((currentKind == SyntaxKind.CloseBracketToken && previousKind == SyntaxKind.OpenBracketToken) 231|| currentKind == SyntaxKind.OmittedArraySizeExpressionToken) 238if (previousKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(previousToken)) 243if (currentKind == SyntaxKind.CloseBracketToken && previousKind != SyntaxKind.OmittedArraySizeExpressionToken && HasFormattableBracketParent(currentToken)) 249if (previousKind == SyntaxKind.CloseBracketToken && previousToken.Parent.IsKind(SyntaxKind.AttributeList)) 252if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 253currentToken.Parent.IsKind(SyntaxKind.AttributeList)) 259if (currentToken.IsKind(SyntaxKind.EndOfFileToken)) 292bool IsCommaWithCustomSpacing(SyntaxToken previousToken, SyntaxToken currentToken, SyntaxKind currentKind, SyntaxKind previousKind, bool checkPreviousToken) 295var tokenKind = checkPreviousToken ? previousKind : currentKind; 296var otherKind = checkPreviousToken ? currentKind : previousKind; 298return (token.IsCommaInArgumentOrParameterList() && otherKind != SyntaxKind.OmittedTypeArgumentToken) 304|| (tokenKind == SyntaxKind.CommaToken 305&& otherKind != SyntaxKind.OmittedArraySizeExpressionToken 322if (previousToken.IsSemicolonInForStatement() && currentKind != SyntaxKind.CloseParenToken) 338currentToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern || 339previousToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern) 346if (currentKind == SyntaxKind.IsKeyword || 347currentKind == SyntaxKind.AsKeyword || 348currentKind == SyntaxKind.AndKeyword || 349currentKind == SyntaxKind.OrKeyword || 350previousKind == SyntaxKind.IsKeyword || 351previousKind == SyntaxKind.AsKeyword || 352previousKind == SyntaxKind.AndKeyword || 353previousKind == SyntaxKind.OrKeyword) 371if (previousParentKind == SyntaxKind.FunctionPointerType) 374if (currentKind == SyntaxKind.AsteriskToken && previousKind == SyntaxKind.DelegateKeyword) 380if (previousKind == SyntaxKind.AsteriskToken && currentParentKind == SyntaxKind.FunctionPointerCallingConvention) 384case SyntaxKind.IdentifierToken: 385case SyntaxKind.ManagedKeyword: 386case SyntaxKind.UnmanagedKeyword: 392if (currentParentKind == SyntaxKind.FunctionPointerParameterList && currentKind == SyntaxKind.LessThanToken) 397case SyntaxKind.AsteriskToken: 400case SyntaxKind.ManagedKeyword: 401case SyntaxKind.UnmanagedKeyword: 404case SyntaxKind.CloseBracketToken when previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList: 411if (previousParentKind == SyntaxKind.FunctionPointerCallingConvention && currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && currentKind == SyntaxKind.OpenBracketToken) 417if (currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList) 419if (currentKind == SyntaxKind.IdentifierToken) 423if (previousKind == SyntaxKind.OpenBracketToken) 429else if (previousKind == SyntaxKind.CommaToken) 437if (currentKind == SyntaxKind.CommaToken) 444if (currentKind == SyntaxKind.CloseBracketToken) 452if (previousKind == SyntaxKind.LessThanToken && previousParentKind == SyntaxKind.FunctionPointerParameterList) 459if (currentKind == SyntaxKind.GreaterThanToken && currentParentKind == SyntaxKind.FunctionPointerParameterList) 465if (previousToken.Parent.IsKind(SyntaxKind.NotPattern)) 472if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.SlicePattern) 478if (previousKind is SyntaxKind.InterpolatedStringStartToken or 479SyntaxKind.InterpolatedVerbatimStringStartToken or 480SyntaxKind.InterpolatedSingleLineRawStringStartToken or 481SyntaxKind.InterpolatedMultiLineRawStringStartToken) 487if (currentKind is SyntaxKind.InterpolatedStringEndToken or 488SyntaxKind.InterpolatedRawStringEndToken) 494if ((currentKind == SyntaxKind.OpenBraceToken && currentToken.Parent is InterpolationSyntax) || 495(previousKind == SyntaxKind.CloseBraceToken && previousToken.Parent is InterpolationSyntax)) 501if (previousKind == SyntaxKind.OpenBraceToken && previousToken.Parent is InterpolationSyntax) 507if (currentKind == SyntaxKind.CloseBraceToken && currentToken.Parent is InterpolationSyntax interpolation) 518if ((previousKind == SyntaxKind.CommaToken && previousToken.Parent is InterpolationAlignmentClauseSyntax) || 519(currentKind == SyntaxKind.CommaToken && currentToken.Parent is InterpolationAlignmentClauseSyntax)) 525if ((previousKind == SyntaxKind.ColonToken && previousToken.Parent is InterpolationFormatClauseSyntax) || 526(currentKind == SyntaxKind.ColonToken && currentToken.Parent is InterpolationFormatClauseSyntax)) 538if (previousKind == SyntaxKind.CaretToken && previousParentKind == SyntaxKind.IndexExpression) 544if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.RangeExpression) 555if (currentKind == SyntaxKind.DotDotToken && currentParentKind == SyntaxKind.RangeExpression) 581is SyntaxKind.FieldDeclaration 582or SyntaxKind.EventDeclaration 583or SyntaxKind.EventFieldDeclaration 584or SyntaxKind.LocalDeclarationStatement 585or SyntaxKind.EnumMemberDeclaration) 610=> token.Parent is (kind: SyntaxKind.ArrayRankSpecifier or SyntaxKind.BracketedArgumentList or SyntaxKind.BracketedParameterList or SyntaxKind.ImplicitArrayCreationExpression or SyntaxKind.ListPattern or SyntaxKind.CollectionExpression); 612private static bool IsFunctionLikeKeywordExpressionKind(SyntaxKind syntaxKind) 613=> (syntaxKind is SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression); 615private static bool IsControlFlowLikeKeywordStatementKind(SyntaxKind syntaxKind) 617return syntaxKind is SyntaxKind.IfStatement or SyntaxKind.WhileStatement or SyntaxKind.SwitchStatement or 618SyntaxKind.ForStatement or SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement or 619SyntaxKind.DoStatement or 620SyntaxKind.CatchDeclaration or SyntaxKind.UsingStatement or SyntaxKind.LockStatement or 621SyntaxKind.FixedStatement or SyntaxKind.CatchFilterClause;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\StructuredTriviaFormattingRule.cs (8)
31((previousToken.Kind() == SyntaxKind.HashToken && currentToken.Kind() == SyntaxKind.ColonToken) || 32(previousToken.Kind() == SyntaxKind.ColonToken && currentToken.Kind() == SyntaxKind.StringLiteralToken))) 38if (previousToken.Kind() == SyntaxKind.HashToken && SyntaxFacts.IsPreprocessorKeyword(currentToken.Kind())) 43if (previousToken.Kind() == SyntaxKind.RegionKeyword && currentToken.Kind() == SyntaxKind.EndOfDirectiveToken) 48if (currentToken.Kind() == SyntaxKind.EndOfDirectiveToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (8)
80if (node.IsKind(SyntaxKind.SwitchExpressionArm)) 88if (node.IsKind(SyntaxKind.SwitchExpression)) 257if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 314if (!IsFormatDirective(pragmaWarningDirectiveTrivia, SyntaxKind.DisableKeyword)) 321var endDirective = pragmaWarningDirectiveTrivia.GetNextDirective(trivia => IsFormatDirective(trivia, SyntaxKind.RestoreKeyword)); 326Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None)); 332private static bool IsFormatDirective(DirectiveTriviaSyntax? trivia, SyntaxKind disableOrRestoreKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (101)
52case SyntaxKind.OpenBraceToken: 61case SyntaxKind.CloseBraceToken: 69if (previousToken.Kind() == SyntaxKind.CloseBraceToken && currentToken.Kind() == SyntaxKind.WhileKeyword) 77case SyntaxKind.CloseBraceToken: 83if (!currentToken.IsKind(SyntaxKind.SemicolonToken) && 103case SyntaxKind.OpenBraceToken: 144if (previousToken.Kind() == SyntaxKind.ElseKeyword) 146var isElseIfOnSameLine = currentToken.Kind() == SyntaxKind.IfKeyword && FormattingHelpers.AreOnSameLine(previousToken, currentToken); 165if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 170if (previousToken.Kind() == SyntaxKind.DoKeyword && previousToken.Parent.IsKind(SyntaxKind.DoStatement)) 182if (previousToken.Kind() == SyntaxKind.SemicolonToken && 183(currentToken.Kind() == SyntaxKind.CaseKeyword || currentToken.Kind() == SyntaxKind.DefaultKeyword || currentToken.Kind() == SyntaxKind.ElseKeyword)) 189if (previousToken.Kind() == SyntaxKind.SemicolonToken) 194if (currentToken.Kind() == SyntaxKind.SemicolonToken && 203if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 301if (usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword)) 315if (currentToken.Kind() == SyntaxKind.SemicolonToken) 318if (previousToken.Kind() == SyntaxKind.SemicolonToken) 322if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 330if (previousToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 331previousToken.Kind() == SyntaxKind.OmittedTypeArgumentToken || 332currentToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 333currentToken.Kind() == SyntaxKind.OmittedTypeArgumentToken) 338if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 339previousToken.Parent.IsKind(SyntaxKind.AttributeList) && 340previousToken.Parent.IsParentKind(SyntaxKind.Parameter)) 342if (currentToken.IsKind(SyntaxKind.OpenBracketToken)) 358if (currentToken.Kind() == SyntaxKind.OpenParenToken && 359previousToken.Kind() == SyntaxKind.ThisKeyword) 364if (previousToken.Kind() == SyntaxKind.NewKeyword) 369SyntaxKind.ConstructorConstraint or 370SyntaxKind.ImplicitObjectCreationExpression or 371SyntaxKind.ImplicitArrayCreationExpression) ? 0 : 1; 376if (currentToken.Kind() == SyntaxKind.OpenParenToken) 379is SyntaxKind.IdentifierToken 380or SyntaxKind.DefaultKeyword 381or SyntaxKind.BaseKeyword 382or SyntaxKind.ThisKeyword 384or SyntaxKind.ExtensionKeyword 401if (previousToken.Kind() == SyntaxKind.CommaToken && currentToken.Kind() == SyntaxKind.OpenBracketToken && currentToken.Parent is AttributeListSyntax) 407if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 420case SyntaxKind.CloseParenToken: 421case SyntaxKind.CloseBracketToken: 422case SyntaxKind.CommaToken: 423case SyntaxKind.DotToken: 424case SyntaxKind.MinusGreaterThanToken: 429if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 430currentToken.Parent?.Kind() is not SyntaxKind.CollectionExpression and not SyntaxKind.AttributeList && 448if (currentToken.IsKind(SyntaxKind.ColonToken) && 450SyntaxKind.AttributeTargetSpecifier or 451SyntaxKind.CaseSwitchLabel or 452SyntaxKind.CasePatternSwitchLabel or 453SyntaxKind.DefaultSwitchLabel or 454SyntaxKind.ExpressionColon or 458SyntaxKind.LabeledStatement or 459SyntaxKind.NameColon or 460SyntaxKind.SwitchExpressionArm)) 467previousToken.Kind() == SyntaxKind.CloseParenToken) 473if (previousToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList or SyntaxKind.FunctionPointerType)) 476if (previousToken.Kind() == SyntaxKind.LessThanToken) 482if (previousToken.Kind() == SyntaxKind.GreaterThanToken && currentToken.Kind() == SyntaxKind.GreaterThanToken) 489if ((currentToken.Kind() == SyntaxKind.LessThanToken || currentToken.Kind() == SyntaxKind.GreaterThanToken) && 490currentToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList)) 496if ((previousToken.Kind() == SyntaxKind.PlusPlusToken || previousToken.Kind() == SyntaxKind.MinusMinusToken) && 503if ((currentToken.Kind() == SyntaxKind.PlusPlusToken || currentToken.Kind() == SyntaxKind.MinusMinusToken) && 510if (currentToken.IsKind(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression)) 516if (currentToken.Kind() == SyntaxKind.QuestionToken && 517currentToken.Parent is (kind: SyntaxKind.NullableType or SyntaxKind.ClassConstraint)) 523if (currentToken.IsKind(SyntaxKind.QuestionToken) && 524previousToken.Parent?.IsParentKind(SyntaxKind.ArrayType) == true) 530if (currentToken.Kind() == SyntaxKind.ExclamationToken && 531currentToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 537if (currentToken.Kind() == SyntaxKind.AsteriskToken && currentToken.Parent is PointerTypeSyntax) 543if (previousToken.Kind() == SyntaxKind.AsteriskToken && previousToken.Parent is PrefixUnaryExpressionSyntax) 551case SyntaxKind.OpenParenToken: 552case SyntaxKind.OpenBracketToken: 553case SyntaxKind.DotToken: 554case SyntaxKind.MinusGreaterThanToken: 557case SyntaxKind.CloseParenToken: 558case SyntaxKind.CloseBracketToken: 577if (previousToken.Kind() == SyntaxKind.ExclamationToken 578&& !previousToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 584if (previousToken.Kind() == SyntaxKind.TildeToken && (previousToken.Parent is PrefixUnaryExpressionSyntax or DestructorDeclarationSyntax)) 590if (previousToken.Kind() == SyntaxKind.AmpersandToken && 597if (previousToken.Kind() == SyntaxKind.ColonColonToken || currentToken.Kind() == SyntaxKind.ColonColonToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (9)
70if (embeddedStatement.IsKind(SyntaxKind.Block)) 91if (!firstToken.IsKind(SyntaxKind.None) || !lastToken.IsKind(SyntaxKind.None)) 99if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 112if (!(node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block)) 121if (!tokens.firstToken.IsKind(SyntaxKind.None) || !tokens.lastToken.IsKind(SyntaxKind.None)) 179if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (14)
47Contract.ThrowIfTrue(startToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 48Contract.ThrowIfTrue(endToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 71return endToken.IsKind(SyntaxKind.CloseBraceToken) && 72endToken.Parent.IsKind(SyntaxKind.Block) && 73endToken.Parent.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.DoStatement; 78Contract.ThrowIfTrue(token.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 82if (previousToken.Kind() == SyntaxKind.None) 93if (token.IsKind(SyntaxKind.OpenBraceToken) && 98if (nextToken.IsKind(SyntaxKind.CloseBraceToken)) 107if (token.IsKind(SyntaxKind.OpenBraceToken) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (13)
245modifiers.Any(SyntaxKind.PartialKeyword)) 286AssignmentExpressionSyntax _ when token.Kind() == SyntaxKind.EqualsToken => GetDeconstructionAssignmentMethods(semanticModel, node).As<ISymbol>(), 287ForEachVariableStatementSyntax _ when token.Kind() == SyntaxKind.InKeyword => GetDeconstructionForEachMethods(semanticModel, node).As<ISymbol>(), 310if (token.Kind() == SyntaxKind.CommaToken) 320if (ordering.AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 324else if (orderByClauseSyntax.Orderings[0].AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 343return token.IsKind(SyntaxKind.InKeyword) ? queryInfo.CastInfo.GetBestOrAllSymbols() : queryInfo.OperationInfo.GetBestOrAllSymbols(); 369if (token.IsKind(SyntaxKind.CommaToken)) 479SyntaxKind.IfDirectiveTrivia or 480SyntaxKind.ElifDirectiveTrivia or 481SyntaxKind.DefineDirectiveTrivia or 482SyntaxKind.UndefDirectiveTrivia); 501if (!token.IsKind(SyntaxKind.IdentifierToken) ||
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (53)
24case SyntaxKind.ClassDeclaration: 25case SyntaxKind.RecordDeclaration: 26case SyntaxKind.StructDeclaration: 27case SyntaxKind.RecordStructDeclaration: 28case SyntaxKind.InterfaceDeclaration: 29case SyntaxKind.EnumDeclaration: 30case SyntaxKind.DelegateDeclaration: 31return ignoreDeclarationModifiers || !((MemberDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.FileKeyword); 33case SyntaxKind.FieldDeclaration: 34case SyntaxKind.EventFieldDeclaration: 35case SyntaxKind.GetAccessorDeclaration: 36case SyntaxKind.SetAccessorDeclaration: 37case SyntaxKind.InitAccessorDeclaration: 38case SyntaxKind.AddAccessorDeclaration: 39case SyntaxKind.RemoveAccessorDeclaration: 42case SyntaxKind.VariableDeclaration: 45case SyntaxKind.VariableDeclarator: 48case SyntaxKind.ConstructorDeclaration: 50return ignoreDeclarationModifiers || !((ConstructorDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.StaticKeyword); 52case SyntaxKind.PropertyDeclaration: 55case SyntaxKind.IndexerDeclaration: 58case SyntaxKind.OperatorDeclaration: 61case SyntaxKind.ConversionOperatorDeclaration: 64case SyntaxKind.MethodDeclaration: 72if (method.Modifiers.Any(SyntaxKind.PartialKeyword)) 80case SyntaxKind.EventDeclaration: 108(SyntaxKind.PublicKeyword, _) => Accessibility.Public, 110(SyntaxKind.PrivateKeyword, Accessibility.Protected) => Accessibility.ProtectedAndInternal, 111(SyntaxKind.PrivateKeyword, _) => Accessibility.Private, 113(SyntaxKind.InternalKeyword, Accessibility.Protected) => Accessibility.ProtectedOrInternal, 114(SyntaxKind.InternalKeyword, _) => Accessibility.Internal, 116(SyntaxKind.ProtectedKeyword, Accessibility.Private) => Accessibility.ProtectedAndInternal, 117(SyntaxKind.ProtectedKeyword, Accessibility.Internal) => Accessibility.ProtectedOrInternal, 118(SyntaxKind.ProtectedKeyword, _) => Accessibility.Protected, 125SyntaxKind.AbstractKeyword => Modifiers.Abstract, 126SyntaxKind.NewKeyword => Modifiers.New, 127SyntaxKind.OverrideKeyword => Modifiers.Override, 128SyntaxKind.VirtualKeyword => Modifiers.Virtual, 129SyntaxKind.StaticKeyword => Modifiers.Static, 130SyntaxKind.AsyncKeyword => Modifiers.Async, 131SyntaxKind.ConstKeyword => Modifiers.Const, 132SyntaxKind.ReadOnlyKeyword => Modifiers.ReadOnly, 133SyntaxKind.SealedKeyword => Modifiers.Sealed, 134SyntaxKind.UnsafeKeyword => Modifiers.Unsafe, 135SyntaxKind.PartialKeyword => Modifiers.Partial, 136SyntaxKind.RefKeyword => Modifiers.Ref, 137SyntaxKind.VolatileKeyword => Modifiers.Volatile, 138SyntaxKind.ExternKeyword => Modifiers.Extern, 139SyntaxKind.FileKeyword => Modifiers.File, 141SyntaxKind.ClosedKeyword => Modifiers.Closed, 143SyntaxKind.RequiredKeyword => Modifiers.Required, 144SyntaxKind.FixedKeyword => Modifiers.Fixed, 148isDefault |= token.Kind() == SyntaxKind.DefaultKeyword;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (4)
22=> node.IsKind(SyntaxKind.Block); 25=> node is (kind: SyntaxKind.Block or SyntaxKind.SwitchSection or SyntaxKind.CompilationUnit);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpFileBannerFacts.cs (4)
22=> trivia.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (175)
101var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 110var kind = token.Kind(); 149if (lineDirective.Line.Kind() == SyntaxKind.DefaultKeyword) 154else if (lineDirective.Line.Kind() == SyntaxKind.NumericLiteralToken && 201=> node is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList); 222=> node is LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not (int)SyntaxKind.None }; 268=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.ThisConstructorInitializer) constructorInit && 272=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.BaseConstructorInitializer) constructorInit && 282case SyntaxKind.FromKeyword: 283case SyntaxKind.JoinKeyword: 284case SyntaxKind.LetKeyword: 285case SyntaxKind.OrderByKeyword: 286case SyntaxKind.WhereKeyword: 287case SyntaxKind.OnKeyword: 288case SyntaxKind.EqualsKeyword: 289case SyntaxKind.InKeyword: 291case SyntaxKind.ByKeyword: 292case SyntaxKind.GroupKeyword: 293case SyntaxKind.SelectKeyword: 295case SyntaxKind.AscendingKeyword: 296case SyntaxKind.DescendingKeyword: 298case SyntaxKind.IntoKeyword: 299return token.Parent is (kind: SyntaxKind.JoinIntoClause or SyntaxKind.QueryContinuation); 326SyntaxKind.BoolKeyword => PredefinedType.Boolean, 327SyntaxKind.ByteKeyword => PredefinedType.Byte, 328SyntaxKind.SByteKeyword => PredefinedType.SByte, 329SyntaxKind.IntKeyword => PredefinedType.Int32, 330SyntaxKind.UIntKeyword => PredefinedType.UInt32, 331SyntaxKind.ShortKeyword => PredefinedType.Int16, 332SyntaxKind.UShortKeyword => PredefinedType.UInt16, 333SyntaxKind.LongKeyword => PredefinedType.Int64, 334SyntaxKind.ULongKeyword => PredefinedType.UInt64, 335SyntaxKind.FloatKeyword => PredefinedType.Single, 336SyntaxKind.DoubleKeyword => PredefinedType.Double, 337SyntaxKind.DecimalKeyword => PredefinedType.Decimal, 338SyntaxKind.StringKeyword => PredefinedType.String, 339SyntaxKind.CharKeyword => PredefinedType.Char, 340SyntaxKind.ObjectKeyword => PredefinedType.Object, 341SyntaxKind.VoidKeyword => PredefinedType.Void, 342SyntaxKind.IdentifierToken => token.Text switch 365switch ((SyntaxKind)token.RawKind) 367case SyntaxKind.PlusToken: 368case SyntaxKind.PlusEqualsToken: 371case SyntaxKind.MinusToken: 372case SyntaxKind.MinusEqualsToken: 375case SyntaxKind.AmpersandAmpersandToken: // overridden bitwise & can be accessed through && 376case SyntaxKind.AmpersandToken: 377case SyntaxKind.AmpersandEqualsToken: 380case SyntaxKind.BarBarToken: // overridden bitwise | can be accessed through || 381case SyntaxKind.BarToken: 382case SyntaxKind.BarEqualsToken: 385case SyntaxKind.MinusMinusToken: 388case SyntaxKind.PlusPlusToken: 391case SyntaxKind.SlashToken: 392case SyntaxKind.SlashEqualsToken: 395case SyntaxKind.EqualsEqualsToken: 398case SyntaxKind.CaretToken: 399case SyntaxKind.CaretEqualsToken: 402case SyntaxKind.GreaterThanToken: 405case SyntaxKind.GreaterThanEqualsToken: 408case SyntaxKind.ExclamationEqualsToken: 411case SyntaxKind.LessThanLessThanToken: 412case SyntaxKind.LessThanLessThanEqualsToken: 415case SyntaxKind.LessThanToken: 418case SyntaxKind.LessThanEqualsToken: 421case SyntaxKind.AsteriskToken: 422case SyntaxKind.AsteriskEqualsToken: 425case SyntaxKind.PercentToken: 426case SyntaxKind.PercentEqualsToken: 429case SyntaxKind.ExclamationToken: 430case SyntaxKind.TildeToken: 433case SyntaxKind.GreaterThanGreaterThanToken: 434case SyntaxKind.GreaterThanGreaterThanEqualsToken: 437case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 438case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 446=> SyntaxFacts.GetText((SyntaxKind)kind); 478case SyntaxKind.NumericLiteralToken: 479case SyntaxKind.CharacterLiteralToken: 480case SyntaxKind.StringLiteralToken: 481case SyntaxKind.Utf8StringLiteralToken: 482case SyntaxKind.SingleLineRawStringLiteralToken: 483case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 484case SyntaxKind.MultiLineRawStringLiteralToken: 485case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 486case SyntaxKind.NullKeyword: 487case SyntaxKind.TrueKeyword: 488case SyntaxKind.FalseKeyword: 489case SyntaxKind.InterpolatedStringStartToken: 490case SyntaxKind.InterpolatedStringEndToken: 491case SyntaxKind.InterpolatedRawStringEndToken: 492case SyntaxKind.InterpolatedVerbatimStringStartToken: 493case SyntaxKind.InterpolatedStringTextToken: 494case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 495case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 503=> token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken; 511case SyntaxKind.DelegateKeyword: 512case SyntaxKind.VoidKeyword: 520if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.OrderByClause)) 523if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CloseBracketToken) 525if (token.Parent.IsKind(SyntaxKind.CollectionExpression)) 545=> (node as MemberAccessExpressionSyntax)?.Kind() == SyntaxKind.PointerMemberAccessExpression; 555=> simpleName.IsKind(SyntaxKind.GenericName) || 556simpleName.GetLastToken().GetNextToken().Kind() == SyntaxKind.LessThanToken; 587=> node.IsKind(SyntaxKind.BaseList); 599=> node.IsKind(SyntaxKind.Argument); 602=> node.IsKind(SyntaxKind.AttributeArgument); 607argument.RefOrOutKeyword.Kind() == SyntaxKind.None && 635=> node.IsKind(SyntaxKind.IdentifierName) && 636node.IsParentKind(SyntaxKind.NameColon) && 637node.Parent.IsParentKind(SyntaxKind.Subpattern); 640=> node.Kind() == SyntaxKind.PropertyPatternClause; 649if (identifier.Parent.IsParentKind(SyntaxKind.WithInitializerExpression)) 655else if (identifier.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression)) 663else if (objectInitializer?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment) 694=> node.IsKind(SyntaxKind.ElementAccessExpression); 724var kind = node.Kind(); 725if ((kind != SyntaxKind.GlobalStatement) && (kind != SyntaxKind.IncompleteMember) && (node is TMemberDeclarationSyntax)) 816case SyntaxKind.CompilationUnit: 818case SyntaxKind.IdentifierName: 821case SyntaxKind.IncompleteMember: 823case SyntaxKind.NamespaceDeclaration: 824case SyntaxKind.FileScopedNamespaceDeclaration: 826case SyntaxKind.QualifiedName: 840if (memberDeclaration.Kind() == SyntaxKind.DestructorDeclaration) 865Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember); 1016if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 1022if (token.Kind() == SyntaxKind.EndOfFileToken) 1091=> node?.Parent?.Kind() is SyntaxKind.PostIncrementExpression or SyntaxKind.PreIncrementExpression; 1094=> node?.Parent?.Kind() is SyntaxKind.PostDecrementExpression or SyntaxKind.PreDecrementExpression; 1107SyntaxKind.SingleLineRawStringLiteralToken or 1108SyntaxKind.MultiLineRawStringLiteralToken or 1109SyntaxKind.Utf8SingleLineRawStringLiteralToken or 1110SyntaxKind.Utf8MultiLineRawStringLiteralToken; 1113=> token.Kind() == SyntaxKind.NumericLiteralToken; 1139=> trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia; 1145=> node?.Kind() is SyntaxKind.UsingDirective or SyntaxKind.ExternAliasDirective; 1148=> IsGlobalAttribute(node, SyntaxKind.AssemblyKeyword); 1151=> IsGlobalAttribute(node, SyntaxKind.ModuleKeyword); 1153private static bool IsGlobalAttribute([NotNullWhen(true)] SyntaxNode? node, SyntaxKind attributeTarget) 1154=> node.IsKind(SyntaxKind.Attribute) && 1183case SyntaxKind.VariableDeclarator: 1184return node.Parent?.Parent?.Kind() is SyntaxKind.FieldDeclaration or SyntaxKind.EventFieldDeclaration; 1186case SyntaxKind.FieldDeclaration: 1187case SyntaxKind.MethodDeclaration: 1188case SyntaxKind.PropertyDeclaration: 1189case SyntaxKind.GetAccessorDeclaration: 1190case SyntaxKind.SetAccessorDeclaration: 1191case SyntaxKind.EventDeclaration: 1192case SyntaxKind.EventFieldDeclaration: 1193case SyntaxKind.AddAccessorDeclaration: 1194case SyntaxKind.RemoveAccessorDeclaration: 1195case SyntaxKind.IndexerDeclaration: 1196case SyntaxKind.OperatorDeclaration: 1197case SyntaxKind.ConversionOperatorDeclaration: 1198case SyntaxKind.ConstructorDeclaration: 1199case SyntaxKind.DestructorDeclaration: 1211=> node is ExpressionStatementSyntax { Expression: (kind: SyntaxKind.SimpleAssignmentExpression) }; 1332if (token.Kind() == SyntaxKind.OverrideKeyword && token.Parent is MemberDeclarationSyntax member) 1440=> node is InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedVerbatimStringStartToken) }; 1482=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: IdentifierNameSyntax }; 1485=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: ImplicitElementAccessSyntax }; 1488=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression); 1491=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression); 1687=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression) initExpr ? initExpr.Expressions : default; 1690=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression) initExpr ? initExpr.Expressions : default;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxKinds.cs (151)
19=> (TSyntaxKind)(object)(SyntaxKind)kind; 23=> (int)(SyntaxKind)(object)kind; 25public int ConflictMarkerTrivia => (int)SyntaxKind.ConflictMarkerTrivia; 26public int DisabledTextTrivia => (int)SyntaxKind.DisabledTextTrivia; 27public int EndOfLineTrivia => (int)SyntaxKind.EndOfLineTrivia; 28public int SkippedTokensTrivia => (int)SyntaxKind.SkippedTokensTrivia; 29public int WhitespaceTrivia => (int)SyntaxKind.WhitespaceTrivia; 30public int SingleLineCommentTrivia => (int)SyntaxKind.SingleLineCommentTrivia; 31public int? MultiLineCommentTrivia => (int)SyntaxKind.MultiLineCommentTrivia; 32public int SingleLineDocCommentTrivia => (int)SyntaxKind.SingleLineDocumentationCommentTrivia; 33public int? MultiLineDocCommentTrivia => (int)SyntaxKind.MultiLineDocumentationCommentTrivia; 35public int IfDirectiveTrivia => (int)SyntaxKind.IfDirectiveTrivia; 36public int ElifDirectiveTrivia => (int)SyntaxKind.ElifDirectiveTrivia; 37public int ElseDirectiveTrivia => (int)SyntaxKind.ElseDirectiveTrivia; 38public int EndIfDirectiveTrivia => (int)SyntaxKind.EndIfDirectiveTrivia; 39public int RegionDirectiveTrivia => (int)SyntaxKind.RegionDirectiveTrivia; 40public int EndRegionDirectiveTrivia => (int)SyntaxKind.EndRegionDirectiveTrivia; 41public int? ShebangDirectiveTrivia => (int)SyntaxKind.ShebangDirectiveTrivia; 42public int DefineDirectiveTrivia => (int)SyntaxKind.DefineDirectiveTrivia; 43public int? UndefDirectiveTrivia => (int)SyntaxKind.UndefDirectiveTrivia; 45public int CloseBraceToken => (int)SyntaxKind.CloseBraceToken; 46public int? CloseBracketToken => (int)SyntaxKind.CloseBracketToken; 47public int CloseParenToken => (int)SyntaxKind.CloseParenToken; 48public int CommaToken => (int)SyntaxKind.CommaToken; 49public int ColonToken => (int)SyntaxKind.ColonToken; 50public int CharacterLiteralToken => (int)SyntaxKind.CharacterLiteralToken; 51public int DotToken => (int)SyntaxKind.DotToken; 52public int GreaterThanToken => (int)SyntaxKind.GreaterThanToken; 53public int InterpolatedStringTextToken => (int)SyntaxKind.InterpolatedStringTextToken; 54public int LessThanToken => (int)SyntaxKind.LessThanToken; 55public int LessThanSlashToken => (int)SyntaxKind.LessThanSlashToken; 56public int OpenBraceToken => (int)SyntaxKind.OpenBraceToken; 57public int? OpenBracketToken => (int)SyntaxKind.OpenBracketToken; 58public int OpenParenToken => (int)SyntaxKind.OpenParenToken; 59public int QuestionToken => (int)SyntaxKind.QuestionToken; 60public int StringLiteralToken => (int)SyntaxKind.StringLiteralToken; 61public int? SingleLineRawStringLiteralToken => (int)SyntaxKind.SingleLineRawStringLiteralToken; 62public int? MultiLineRawStringLiteralToken => (int)SyntaxKind.MultiLineRawStringLiteralToken; 63public int? Utf8StringLiteralToken => (int)SyntaxKind.Utf8StringLiteralToken; 64public int? Utf8SingleLineRawStringLiteralToken => (int)SyntaxKind.Utf8SingleLineRawStringLiteralToken; 65public int? Utf8MultiLineRawStringLiteralToken => (int)SyntaxKind.Utf8MultiLineRawStringLiteralToken; 67public int XmlCrefAttribute => (int)SyntaxKind.XmlCrefAttribute; 68public int XmlTextLiteralToken => (int)SyntaxKind.XmlTextLiteralToken; 70public int DelegateKeyword => (int)SyntaxKind.DelegateKeyword; 71public int FalseKeyword => (int)SyntaxKind.FalseKeyword; 72public int IfKeyword => (int)SyntaxKind.IfKeyword; 73public int NewKeyword => (int)SyntaxKind.NewKeyword; 74public int PartialKeyword => (int)SyntaxKind.PartialKeyword; 75public int TrueKeyword => (int)SyntaxKind.TrueKeyword; 76public int UsingKeyword => (int)SyntaxKind.UsingKeyword; 78public int? AliasQualifiedName => (int)SyntaxKind.AliasQualifiedName; 79public int GenericName => (int)SyntaxKind.GenericName; 80public int IdentifierName => (int)SyntaxKind.IdentifierName; 81public int QualifiedName => (int)SyntaxKind.QualifiedName; 83public int TupleType => (int)SyntaxKind.TupleType; 85public int CharacterLiteralExpression => (int)SyntaxKind.CharacterLiteralExpression; 86public int DefaultLiteralExpression => (int)SyntaxKind.DefaultLiteralExpression; 87public int FalseLiteralExpression => (int)SyntaxKind.FalseLiteralExpression; 88public int NullLiteralExpression => (int)SyntaxKind.NullLiteralExpression; 89public int NumericLiteralExpression => (int)SyntaxKind.NumericLiteralExpression; 90public int StringLiteralExpression => (int)SyntaxKind.StringLiteralExpression; 91public int TrueLiteralExpression => (int)SyntaxKind.TrueLiteralExpression; 93public int AddExpression => (int)SyntaxKind.AddExpression; 94public int AddressOfExpression => (int)SyntaxKind.AddressOfExpression; 95public int AnonymousObjectCreationExpression => (int)SyntaxKind.AnonymousObjectCreationExpression; 96public int ArrayCreationExpression => (int)SyntaxKind.ArrayCreationExpression; 97public int AwaitExpression => (int)SyntaxKind.AwaitExpression; 98public int BaseExpression => (int)SyntaxKind.BaseExpression; 99public int? CollectionExpression => (int)SyntaxKind.CollectionExpression; 100public int CollectionInitializerExpression => (int)SyntaxKind.CollectionInitializerExpression; 101public int ConditionalAccessExpression => (int)SyntaxKind.ConditionalAccessExpression; 102public int ConditionalExpression => (int)SyntaxKind.ConditionalExpression; 103public int? FieldExpression => (int)SyntaxKind.FieldExpression; 104public int? ImplicitArrayCreationExpression => (int)SyntaxKind.ImplicitArrayCreationExpression; 105public int? ImplicitObjectCreationExpression => (int)SyntaxKind.ImplicitObjectCreationExpression; 106public int? IndexExpression => (int)SyntaxKind.IndexExpression; 107public int InvocationExpression => (int)SyntaxKind.InvocationExpression; 108public int? IsPatternExpression => (int)SyntaxKind.IsPatternExpression; 109public int IsTypeExpression => (int)SyntaxKind.IsExpression; 111public int LogicalAndExpression => (int)SyntaxKind.LogicalAndExpression; 112public int LogicalOrExpression => (int)SyntaxKind.LogicalOrExpression; 113public int LogicalNotExpression => (int)SyntaxKind.LogicalNotExpression; 114public int ObjectCreationExpression => (int)SyntaxKind.ObjectCreationExpression; 115public int ParenthesizedExpression => (int)SyntaxKind.ParenthesizedExpression; 116public int QueryExpression => (int)SyntaxKind.QueryExpression; 117public int? RangeExpression => (int)SyntaxKind.RangeExpression; 118public int? RefExpression => (int)SyntaxKind.RefExpression; 119public int ReferenceEqualsExpression => (int)SyntaxKind.EqualsExpression; 120public int ReferenceNotEqualsExpression => (int)SyntaxKind.NotEqualsExpression; 121public int SimpleAssignmentExpression => (int)SyntaxKind.SimpleAssignmentExpression; 122public int SimpleMemberAccessExpression => (int)SyntaxKind.SimpleMemberAccessExpression; 123public int? SizeOfExpression => (int)SyntaxKind.SizeOfExpression; 124public int? SuppressNullableWarningExpression => (int)SyntaxKind.SuppressNullableWarningExpression; 125public int TernaryConditionalExpression => (int)SyntaxKind.ConditionalExpression; 126public int ThisExpression => (int)SyntaxKind.ThisExpression; 127public int? ThrowExpression => (int)SyntaxKind.ThrowExpression; 128public int TupleExpression => (int)SyntaxKind.TupleExpression; 129public int TypeOfExpression => (int)SyntaxKind.TypeOfExpression; 131public int? AndPattern => (int)SyntaxKind.AndPattern; 132public int? ConstantPattern => (int)SyntaxKind.ConstantPattern; 133public int? DeclarationPattern => (int)SyntaxKind.DeclarationPattern; 134public int? ListPattern => (int)SyntaxKind.ListPattern; 135public int? NotPattern => (int)SyntaxKind.NotPattern; 136public int? OrPattern => (int)SyntaxKind.OrPattern; 137public int? ParenthesizedPattern => (int)SyntaxKind.ParenthesizedPattern; 138public int? RecursivePattern => (int)SyntaxKind.RecursivePattern; 139public int? RelationalPattern => (int)SyntaxKind.RelationalPattern; 140public int? TypePattern => (int)SyntaxKind.TypePattern; 141public int? VarPattern => (int)SyntaxKind.VarPattern; 143public int EndOfFileToken => (int)SyntaxKind.EndOfFileToken; 144public int AwaitKeyword => (int)SyntaxKind.AwaitKeyword; 145public int AsyncKeyword => (int)SyntaxKind.AsyncKeyword; 146public int IdentifierToken => (int)SyntaxKind.IdentifierToken; 147public int GlobalKeyword => (int)SyntaxKind.GlobalKeyword; 148public int IncompleteMember => (int)SyntaxKind.IncompleteMember; 149public int HashToken => (int)SyntaxKind.HashToken; 151public int ExpressionStatement => (int)SyntaxKind.ExpressionStatement; 152public int ForEachStatement => (int)SyntaxKind.ForEachStatement; 153public int ForStatement => (int)SyntaxKind.ForStatement; 154public int IfStatement => (int)SyntaxKind.IfStatement; 155public int LocalDeclarationStatement => (int)SyntaxKind.LocalDeclarationStatement; 156public int? LocalFunctionStatement => (int)SyntaxKind.LocalFunctionStatement; 157public int LockStatement => (int)SyntaxKind.LockStatement; 158public int ReturnStatement => (int)SyntaxKind.ReturnStatement; 159public int ThrowStatement => (int)SyntaxKind.ThrowStatement; 160public int UsingStatement => (int)SyntaxKind.UsingStatement; 161public int WhileStatement => (int)SyntaxKind.WhileStatement; 162public int YieldReturnStatement => (int)SyntaxKind.YieldReturnStatement; 163public int Attribute => (int)SyntaxKind.Attribute; 164public int ClassDeclaration => (int)SyntaxKind.ClassDeclaration; 165public int ConstructorDeclaration => (int)SyntaxKind.ConstructorDeclaration; 166public int EnumDeclaration => (int)SyntaxKind.EnumDeclaration; 167public int InterfaceDeclaration => (int)SyntaxKind.InterfaceDeclaration; 168public int? StructDeclaration => (int)SyntaxKind.StructDeclaration; 169public int Parameter => (int)SyntaxKind.Parameter; 170public int TypeConstraint => (int)SyntaxKind.TypeConstraint; 171public int VariableDeclarator => (int)SyntaxKind.VariableDeclarator; 172public int FieldDeclaration => (int)SyntaxKind.FieldDeclaration; 173public int PropertyDeclaration => (int)SyntaxKind.PropertyDeclaration; 174public int ParameterList => (int)SyntaxKind.ParameterList; 175public int TypeArgumentList => (int)SyntaxKind.TypeArgumentList; 176public int? GlobalStatement => (int)SyntaxKind.GlobalStatement; 178public int ElseClause => (int)SyntaxKind.ElseClause; 179public int EqualsValueClause => (int)SyntaxKind.EqualsValueClause; 181public int? ExpressionElement => (int)SyntaxKind.ExpressionElement; 182public int? ImplicitElementAccess => (int)SyntaxKind.ImplicitElementAccess; 183public int Interpolation => (int)SyntaxKind.Interpolation; 184public int InterpolatedStringExpression => (int)SyntaxKind.InterpolatedStringExpression; 185public int InterpolatedStringText => (int)SyntaxKind.InterpolatedStringText; 186public int? IndexerMemberCref => (int)SyntaxKind.IndexerMemberCref; 187public int? PrimaryConstructorBaseType => (int)SyntaxKind.PrimaryConstructorBaseType;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (1)
14if (node.NameColon == null || !node.Parent.IsKind(SyntaxKind.TupleExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (21)
56return cast.Kind() == SyntaxKind.AsExpression && 126if (leftOrRightChild.Parent is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) binary) 160if (castExpression.WalkUpParentheses().Parent is PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression) parent && 187var isDefaultLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression); 231if (castSyntax.WalkUpParentheses().GetRequiredParent().Kind() is SyntaxKind.BitwiseOrExpression or SyntaxKind.OrAssignmentExpression) 334var isNullLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.NullLiteralExpression); 504if (castNode.WalkUpParentheses().Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) isExpression && 570if (castNode.IsParentKind(SyntaxKind.Interpolation) && originalConversionOperation.Type?.SpecialType is SpecialType.System_Object) 815if (parent is not PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression)) 820Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 947if (armExpression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 998if (castExpression.Expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 1063is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) parentBinary) 1151=> node is ExpressionSyntax expression && expression.WalkDownParentheses().Kind() is SyntaxKind.CastExpression or SyntaxKind.AsExpression; 1188if (otherSide.WalkDownParentheses().Kind() == SyntaxKind.NullLiteralExpression) 1257else if (castNode.Parent is InitializerExpressionSyntax(SyntaxKind.ArrayInitializerExpression) arrayInitializer) 1365if (!haveHitArgumentNode && currentOld.Kind() != SyntaxKind.Argument)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (46)
22Contract.ThrowIfTrue(endToken.Kind() == SyntaxKind.None); 40while (currentToken.Kind() != SyntaxKind.CloseBraceToken && previousToken.Kind() == SyntaxKind.OpenBraceToken) 43if (closeBrace.Kind() == SyntaxKind.None || !AreTwoTokensOnSameLine(previousToken, closeBrace)) 60case SyntaxKind.CloseBraceToken: 63case SyntaxKind.SemicolonToken: 66case SyntaxKind.ColonToken: 76if (endToken.Kind() == SyntaxKind.SkippedTokensTrivia) 88if (parent.Kind() is SyntaxKind.StringLiteralExpression or SyntaxKind.CharacterLiteralExpression) 100if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 152if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 252if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 259if (endToken.Kind() == SyntaxKind.ColonToken && parent is LabeledStatementSyntax) 268return previousToken.Kind() == SyntaxKind.None ? token : previousToken; 290if (previousToken.Kind() == SyntaxKind.None) 327return previousToken.IsKind(SyntaxKind.OpenBraceToken) && 328(previousToken.Parent.IsKind(SyntaxKind.Block) || 336node.Kind() is SyntaxKind.IfStatement or 337SyntaxKind.ElseClause or 338SyntaxKind.WhileStatement or 339SyntaxKind.ForStatement or 340SyntaxKind.ForEachStatement or 341SyntaxKind.ForEachVariableStatement or 342SyntaxKind.UsingStatement or 343SyntaxKind.DoStatement or 344SyntaxKind.TryStatement or 345SyntaxKind.CatchClause or 346SyntaxKind.FinallyClause or 347SyntaxKind.LabeledStatement or 348SyntaxKind.LockStatement or 349SyntaxKind.FixedStatement or 350SyntaxKind.UncheckedStatement or 351SyntaxKind.CheckedStatement or 352SyntaxKind.GetAccessorDeclaration or 353SyntaxKind.SetAccessorDeclaration or 354SyntaxKind.InitAccessorDeclaration or 355SyntaxKind.AddAccessorDeclaration or 356SyntaxKind.RemoveAccessorDeclaration; 388return token.Kind() == SyntaxKind.ColonToken && 395if (previousToken.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 400if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 417if (token.Kind() == SyntaxKind.CloseBraceToken) 419if (token.Parent.Kind() is SyntaxKind.Block or 420SyntaxKind.AccessorList)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\NameSyntaxComparer.cs (4)
84case SyntaxKind.QualifiedName: 89case SyntaxKind.AliasQualifiedName: 94case SyntaxKind.IdentifierName: 97case SyntaxKind.GenericName:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (57)
69=> expression.Kind() is SyntaxKind.ThisExpression or SyntaxKind.BaseExpression; 82if (node.Kind() is not SyntaxKind.PrimaryConstructorBaseType || 83previousNode.Kind() is SyntaxKind.ArgumentList) 96=> node is StatementSyntax(kind: not SyntaxKind.Block) or TypeSyntax or CrefSyntax || 97node.Kind() is SyntaxKind.Attribute or 98SyntaxKind.ThisConstructorInitializer or 99SyntaxKind.BaseConstructorInitializer or 100SyntaxKind.EqualsValueClause or 101SyntaxKind.ArrowExpressionClause or 102SyntaxKind.PrimaryConstructorBaseType; 109node => node.Kind() is SyntaxKind.UnknownAccessorDeclaration or SyntaxKind.IncompleteMember or SyntaxKind.BracketedArgumentList), 158case SyntaxKind.Attribute: 162case SyntaxKind.BaseConstructorInitializer: 163case SyntaxKind.ThisConstructorInitializer: 167case SyntaxKind.EqualsValueClause: 171case SyntaxKind.ArrowExpressionClause: 175case SyntaxKind.PrimaryConstructorBaseType: 201case SyntaxKind.ParenthesizedLambdaExpression: 235case SyntaxKind.SimpleLambdaExpression: 300if (currentOriginalNode.Kind() is SyntaxKind.CaseSwitchLabel or SyntaxKind.ConstantPattern) 303if (expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 315else if (currentOriginalNode.Kind() == SyntaxKind.LogicalNotExpression) 319else if (currentOriginalNode.Kind() == SyntaxKind.ConditionalAccessExpression) 336else if (currentOriginalNode.Kind() == SyntaxKind.VariableDeclarator) 467if (previousReplacedExpression.WalkDownParentheses().Kind() is SyntaxKind.NullLiteralExpression or SyntaxKind.DefaultLiteralExpression) 515else if (currentOriginalNode.Kind() == SyntaxKind.CollectionInitializerExpression) 520else if (currentOriginalNode.Kind() == SyntaxKind.ImplicitArrayCreationExpression) 529else if (currentOriginalNode.Kind() == SyntaxKind.DefaultExpression) 582SyntaxKind.InvocationExpression or 583SyntaxKind.ElementAccessExpression or 584SyntaxKind.SimpleMemberAccessExpression or 585SyntaxKind.ImplicitElementAccess or 586SyntaxKind.ObjectCreationExpression; 602SyntaxKind.InvocationExpression => ((InvocationExpressionSyntax)expression).ArgumentList, 603SyntaxKind.ObjectCreationExpression => ((ObjectCreationExpressionSyntax)expression).ArgumentList, 604SyntaxKind.ElementAccessExpression => ((ElementAccessExpressionSyntax)expression).ArgumentList, 615case SyntaxKind.SimpleMemberAccessExpression: 618case SyntaxKind.InvocationExpression: 621if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 629case SyntaxKind.ElementAccessExpression: 632if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 663=> node.IsKind(SyntaxKind.ParenthesizedExpression); 673if (binaryExpression.Kind() is SyntaxKind.AsExpression or SyntaxKind.IsExpression && 720assignmentExpression.Kind() != SyntaxKind.LeftShiftAssignmentExpression && 721assignmentExpression.Kind() != SyntaxKind.RightShiftAssignmentExpression && 773if (newExpression.IsKind(SyntaxKind.ConditionalExpression) && 783if (newExpression.IsKind(SyntaxKind.SwitchExpression) && 793if (newExpression.IsKind(SyntaxKind.CollectionExpression) && 802if (newExpression.IsKind(SyntaxKind.TupleExpression) && 818if (originalExpression.IsKind(SyntaxKind.ConditionalExpression) && 819newExpression.IsKind(SyntaxKind.ConditionalExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TokenComparer.cs (4)
23x.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword && 24y.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (9)
38if (typeName?.FirstAncestorOrSelf<SyntaxNode>(a => a.Kind() is SyntaxKind.DeclarationExpression or SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement) is not { } declaration) 61Debug.Assert(node.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression); 84SyntaxKind.LocalDeclarationStatement or 85SyntaxKind.ForStatement or 86SyntaxKind.UsingStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (1)
104/// to var. <see cref="SyntaxFacts.IsPredefinedType(SyntaxKind)"/> considers string
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (4)
66declExpression.Designation.IsKind(SyntaxKind.ParenthesizedVariableDesignation)) 78if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (6)
104if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) }) 117if (!variableDeclaration.Type.IsKind(SyntaxKind.PointerType) && 248if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 252if (expression.IsKind(SyntaxKind.ImplicitObjectCreationExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeSyntaxComparer.cs (3)
47case SyntaxKind.ArrayType: 50case SyntaxKind.PointerType: 53case SyntaxKind.NullableType:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (5)
29.Select(n => n.GetTrailingTrivia().FirstOrNull(t => t.Kind() == SyntaxKind.EndOfLineTrivia)) 71var directive1IsUsingStatic = using1.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 72var directive2IsUsingStatic = using2.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 170if (!trailingTrivia.Any() || trailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia) 188=> node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.Kind() == SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (3)
95var kind = CodeGenerationConstructorInfo.GetThisConstructorArgumentsOpt(constructor) != null 96? SyntaxKind.ThisConstructorInitializer 97: SyntaxKind.BaseConstructorInitializer;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (12)
95if (t1.Kind() == SyntaxKind.MultiLineCommentTrivia) 100return SyntaxTrivia(SyntaxKind.MultiLineCommentTrivia, text + MultiLineCommentTerminator); 103else if (t1.Kind() == SyntaxKind.SkippedTokensTrivia) 196=> declaration.ChildTokens().Where(t => t.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CloseBraceToken && t.IsMissing).Any(); 233SyntaxKind.ClassDeclaration => CodeGenerationDestination.ClassType, 234SyntaxKind.CompilationUnit => CodeGenerationDestination.CompilationUnit, 235SyntaxKind.EnumDeclaration => CodeGenerationDestination.EnumType, 236SyntaxKind.InterfaceDeclaration => CodeGenerationDestination.InterfaceType, 237SyntaxKind.FileScopedNamespaceDeclaration => CodeGenerationDestination.Namespace, 238SyntaxKind.NamespaceDeclaration => CodeGenerationDestination.Namespace, 239SyntaxKind.StructDeclaration => CodeGenerationDestination.StructType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (20)
457ComputePositionAndTriviaForRemoveAttributeList(attributeList, t => t.IsKind(SyntaxKind.EndOfLineTrivia), out positionOfRemovedNode, out trivia); 463ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, t => t.IsKind(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia); 511var insertionIndex = compilationUnit.Members.LastIndexOf(memberDeclaration => memberDeclaration.IsKind(SyntaxKind.GlobalStatement)) + 1; 515else if (destinationMember is StatementSyntax statement && statement.IsParentKind(SyntaxKind.GlobalStatement)) 786case SyntaxKind.DelegateDeclaration: 794case SyntaxKind.MethodDeclaration: 802case SyntaxKind.OperatorDeclaration: 810case SyntaxKind.ConversionOperatorDeclaration: 818case SyntaxKind.PropertyDeclaration: 826case SyntaxKind.EventDeclaration: 834case SyntaxKind.IndexerDeclaration: 842case SyntaxKind.Parameter: 856case SyntaxKind.IncompleteMember: 870case SyntaxKind.ArrayType: 878case SyntaxKind.PointerType: 886case SyntaxKind.VariableDeclaration: 894case SyntaxKind.CatchDeclaration: 918case SyntaxKind.CompilationUnit: 919case SyntaxKind.NamespaceDeclaration: 920case SyntaxKind.FileScopedNamespaceDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (78)
15private static readonly Dictionary<SyntaxKind, int> s_kindPrecedenceMap = new(SyntaxFacts.EqualityComparer) 17{ SyntaxKind.FieldDeclaration, 0 }, 18{ SyntaxKind.ConstructorDeclaration, 1 }, 19{ SyntaxKind.DestructorDeclaration, 2 }, 20{ SyntaxKind.IndexerDeclaration, 3 }, 21{ SyntaxKind.PropertyDeclaration, 4 }, 22{ SyntaxKind.EventFieldDeclaration, 5 }, 23{ SyntaxKind.EventDeclaration, 6 }, 24{ SyntaxKind.MethodDeclaration, 7 }, 25{ SyntaxKind.OperatorDeclaration, 8 }, 26{ SyntaxKind.ConversionOperatorDeclaration, 9 }, 27{ SyntaxKind.EnumDeclaration, 10 }, 28{ SyntaxKind.InterfaceDeclaration, 11 }, 29{ SyntaxKind.StructDeclaration, 12 }, 30{ SyntaxKind.ClassDeclaration, 13 }, 31{ SyntaxKind.RecordDeclaration, 14 }, 32{ SyntaxKind.RecordStructDeclaration, 15 }, 33{ SyntaxKind.DelegateDeclaration, 16 } 36private static readonly Dictionary<SyntaxKind, int> s_operatorPrecedenceMap = new(SyntaxFacts.EqualityComparer) 38{ SyntaxKind.PlusToken, 0 }, 39{ SyntaxKind.MinusToken, 1 }, 40{ SyntaxKind.ExclamationToken, 2 }, 41{ SyntaxKind.TildeToken, 3 }, 42{ SyntaxKind.PlusPlusToken, 4 }, 43{ SyntaxKind.MinusMinusToken, 5 }, 44{ SyntaxKind.AsteriskToken, 6 }, 45{ SyntaxKind.SlashToken, 7 }, 46{ SyntaxKind.PercentToken, 8 }, 47{ SyntaxKind.AmpersandToken, 9 }, 48{ SyntaxKind.BarToken, 10 }, 49{ SyntaxKind.CaretToken, 11 }, 50{ SyntaxKind.LessThanLessThanToken, 12 }, 51{ SyntaxKind.GreaterThanGreaterThanToken, 13 }, 52{ SyntaxKind.EqualsEqualsToken, 14 }, 53{ SyntaxKind.ExclamationEqualsToken, 15 }, 54{ SyntaxKind.LessThanToken, 16 }, 55{ SyntaxKind.GreaterThanToken, 17 }, 56{ SyntaxKind.LessThanEqualsToken, 18 }, 57{ SyntaxKind.GreaterThanEqualsToken, 19 }, 58{ SyntaxKind.TrueKeyword, 20 }, 59{ SyntaxKind.FalseKeyword, 21 }, 60{ SyntaxKind.GreaterThanGreaterThanGreaterThanToken, 22 }, 103case SyntaxKind.DelegateDeclaration: 106case SyntaxKind.FieldDeclaration: 107case SyntaxKind.EventFieldDeclaration: 110case SyntaxKind.ConstructorDeclaration: 113case SyntaxKind.DestructorDeclaration: 117case SyntaxKind.MethodDeclaration: 120case SyntaxKind.OperatorDeclaration: 123case SyntaxKind.EventDeclaration: 126case SyntaxKind.IndexerDeclaration: 129case SyntaxKind.PropertyDeclaration: 132case SyntaxKind.EnumDeclaration: 135case SyntaxKind.InterfaceDeclaration: 136case SyntaxKind.StructDeclaration: 137case SyntaxKind.RecordStructDeclaration: 138case SyntaxKind.ClassDeclaration: 139case SyntaxKind.RecordDeclaration: 142case SyntaxKind.ConversionOperatorDeclaration: 145case SyntaxKind.IncompleteMember: 148case SyntaxKind.GlobalStatement: 217return x.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword ? -1 : 1; 301private static bool ContainsToken(SyntaxTokenList list, SyntaxKind kind) 316if (ContainsToken(modifiers, SyntaxKind.PublicKeyword)) 320else if (ContainsToken(modifiers, SyntaxKind.ProtectedKeyword)) 322if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 327if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 334else if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 338else if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 347if (node.Kind() == SyntaxKind.InterfaceDeclaration) 352else if (node.Kind() is SyntaxKind.StructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration) 362private static bool BothHaveModifier(SyntaxTokenList x, SyntaxTokenList y, SyntaxKind modifierKind, out int comparisonResult) 378=> BothHaveModifier(x, y, SyntaxKind.StaticKeyword, out comparisonResult); 381=> BothHaveModifier(x, y, SyntaxKind.ConstKeyword, out comparisonResult); 384=> BothHaveModifier(x, y, SyntaxKind.ReadOnlyKeyword, out comparisonResult);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (9)
34else if (members.LastOrDefault().Kind() == SyntaxKind.CommaToken) 118if (lastExpression.Kind() == SyntaxKind.LeftShiftExpression && 122if (binaryExpression.Left.Kind() == SyntaxKind.NumericLiteralExpression) 132SyntaxKind.LeftShiftExpression, 133LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(numericLiteral.Token.Text, 1)), 134LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(shiftValue.ToString(), shiftValue))); 138else if (lastExpression is LiteralExpressionSyntax(SyntaxKind.NumericLiteralExpression) numericLiteral) 146return LiteralExpression(SyntaxKind.NumericLiteralExpression, 151return LiteralExpression(SyntaxKind.NumericLiteralExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (7)
28if (eventDeclaration.Kind() == SyntaxKind.EventFieldDeclaration) 36if (eventDeclaration.Kind() == SyntaxKind.EventDeclaration) 53if (eventDeclaration.Kind() == SyntaxKind.FieldDeclaration) 164GenerateAccessorDeclaration(@event, @event.AddMethod, SyntaxKind.AddAccessorDeclaration, destination, info), 165GenerateAccessorDeclaration(@event, @event.RemoveMethod, SyntaxKind.RemoveAccessorDeclaration, destination, info), 174SyntaxKind kind, 186SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (18)
42InitializerExpression(SyntaxKind.ArrayInitializerExpression, 51=> LiteralExpression(SyntaxKind.NullLiteralExpression); 108? SyntaxKind.TrueLiteralExpression 109: SyntaxKind.FalseLiteralExpression); 116SyntaxKind.StringLiteralExpression, Literal(valueString, val)); 123SyntaxKind.CharacterLiteralExpression, Literal(literal, val)); 186return BinaryExpression(SyntaxKind.DivideExpression, 192return BinaryExpression(SyntaxKind.DivideExpression, 198return BinaryExpression(SyntaxKind.DivideExpression, 199PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateDoubleLiteralExpression(null, 1.0, false)), 215return BinaryExpression(SyntaxKind.DivideExpression, 221return BinaryExpression(SyntaxKind.DivideExpression, 227return BinaryExpression(SyntaxKind.DivideExpression, 228PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateSingleLiteralExpression(null, 1.0F, false)), 279SyntaxKind.NumericLiteralExpression, tokenFactory(stringValue, nonNegativeValue)); 282? PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, literal) 299var result = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, memberAccess, IdentifierName(constant.Value)); 315: MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, result, name);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (6)
28.Where(f => f.Modifiers.Any(SyntaxKind.ConstKeyword)) 33if (fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword)) 39.Where(f => f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)) 43.Where(f => !f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword) && !f.Modifiers.Any(SyntaxKind.ConstKeyword)) 48return fieldDeclaration.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (2)
26private static readonly TypeParameterConstraintSyntax s_classConstraint = ClassOrStructConstraint(SyntaxKind.ClassConstraint); 27private static readonly TypeParameterConstraintSyntax s_structConstraint = ClassOrStructConstraint(SyntaxKind.StructConstraint);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (14)
168case SyntaxKind.EnumDeclaration: 171case SyntaxKind.StructDeclaration: 172case SyntaxKind.RecordStructDeclaration: 173case SyntaxKind.InterfaceDeclaration: 174case SyntaxKind.ClassDeclaration: 175case SyntaxKind.RecordDeclaration: 201var declarationKind = isRecordClass ? SyntaxKind.RecordDeclaration : SyntaxKind.RecordStructDeclaration; 202var classOrStructKeyword = Token(isRecordClass ? default : SyntaxKind.StructKeyword); 211var kind = namedType.TypeKind == TypeKind.Struct ? SyntaxKind.StructDeclaration : 212namedType.TypeKind == TypeKind.Interface ? SyntaxKind.InterfaceDeclaration : SyntaxKind.ClassDeclaration;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (2)
82var operatorSyntaxKind = SyntaxFacts.GetOperatorKind(method.MetadataName); 83if (operatorSyntaxKind == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (8)
185if (accessor.IsKind(SyntaxKind.GetAccessorDeclaration)) 252SyntaxKind declarationKind, AccessorDeclarationSyntax accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference, CancellationToken cancellationToken, 279var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 282GenerateAccessorDeclaration(property, property.GetMethod, SyntaxKind.GetAccessorDeclaration, destination, info, cancellationToken), 294SyntaxKind kind, 308SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (7)
164case SyntaxKind.IdentifierName: 165case SyntaxKind.GenericName: 169case SyntaxKind.SimpleMemberAccessExpression: 170case SyntaxKind.PointerMemberAccessExpression: 174case SyntaxKind.SimpleLambdaExpression: 175case SyntaxKind.ParenthesizedLambdaExpression: 176case SyntaxKind.AnonymousMethodExpression:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\BasePropertyDeclarationSyntaxExtensions.cs (4)
21case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).SemicolonToken; 22case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).SemicolonToken; 39case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).WithSemicolonToken(semicolonToken); 40case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).WithSemicolonToken(semicolonToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (4)
130Debug.Assert(!endOfLine.IsKind(SyntaxKind.None)); 131if (!endOfLine.IsKind(SyntaxKind.None)) 150if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.IfDirectiveTrivia))) 155if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.EndIfDirectiveTrivia)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (42)
48public readonly ISet<SyntaxKind> PrecedingModifiers; 111ISet<SyntaxKind> precedingModifiers, 213targetToken.IsKind(SyntaxKind.TildeToken) && 214targetToken.Parent.IsKind(SyntaxKind.DestructorDeclaration) && 215targetToken.Parent.Parent is (kind: SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration); 224var isOnArgumentListBracketOrComma = targetToken.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList or SyntaxKind.ArrayRankSpecifier); 246isCrefContext: syntaxTree.IsCrefContext(position, cancellationToken) && !leftToken.IsKind(SyntaxKind.DotToken), 263isTaskLikeTypeContext: precedingModifiers.Contains(SyntaxKind.AsyncKeyword), 312if (token.Kind() == SyntaxKind.OpenBracketToken && 313token.Parent.IsKind(SyntaxKind.AttributeList) && 324ISet<SyntaxKind>? validModifiers = null, 325ISet<SyntaxKind>? validTypeDeclarations = null, 332public bool IsRecordDeclarationContext(ISet<SyntaxKind> validModifiers, CancellationToken cancellationToken) 336if (!previousToken.IsKind(SyntaxKind.RecordKeyword)) 346ISet<SyntaxKind> validTypeDeclarations, bool includingRecordParameters, CancellationToken cancellationToken) 352if (token.Kind() == SyntaxKind.OpenBracketToken && 353token.Parent.IsKind(SyntaxKind.AttributeList)) 376if (token.Kind() == SyntaxKind.OpenBracketToken && 377token.Parent.IsKind(SyntaxKind.AttributeList) && 392if (token.Kind() == SyntaxKind.OpenBracketToken && 393token.Parent.IsKind(SyntaxKind.AttributeList) && 403ISet<SyntaxKind>? validModifiers = null, 404ISet<SyntaxKind>? validTypeDeclarations = null, 439if (targetToken.IsKind(SyntaxKind.AwaitKeyword)) 450&& targetToken.IsKind(SyntaxKind.IdentifierToken) 451&& targetToken.HasMatchingText(SyntaxKind.AwaitKeyword)) 483if (node.IsKind(SyntaxKind.QueryExpression)) 487if (targetToken.IsKind(SyntaxKind.InKeyword)) 534SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword => AttributeTargets.Assembly | AttributeTargets.Module, 535SyntaxKind.TypeKeyword => AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, 536SyntaxKind.MethodKeyword => AttributeTargets.Method, 537SyntaxKind.FieldKeyword => AttributeTargets.Field, 538SyntaxKind.PropertyKeyword => AttributeTargets.Property, 539SyntaxKind.EventKeyword => AttributeTargets.Event, 540SyntaxKind.ParamKeyword => AttributeTargets.Parameter, 541SyntaxKind.ReturnKeyword => AttributeTargets.ReturnValue, 542SyntaxKind.TypeVarKeyword => AttributeTargets.GenericParameter, 555RecordDeclarationSyntax record => record.ClassOrStructKeyword.IsKind(SyntaxKind.StructKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (114)
19token.Kind() is SyntaxKind.UsingKeyword or 20SyntaxKind.ExternKeyword; 25if (token.IsKind(SyntaxKind.UsingKeyword)) 41if (token is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 47if (token.IsKind(SyntaxKind.UnsafeKeyword) && 48token.GetPreviousToken() is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 115case SyntaxKind.OpenBraceToken when token.Parent.IsKind(SyntaxKind.Block): 118case SyntaxKind.SemicolonToken: 120return statement != null && !statement.IsParentKind(SyntaxKind.GlobalStatement) && 123case SyntaxKind.CloseBraceToken: 124if (token.Parent.IsKind(SyntaxKind.Block)) 135if (token.Parent.Parent.Kind() is not SyntaxKind.TryStatement and not SyntaxKind.DoStatement) 139is SyntaxKind.ElseClause 140or SyntaxKind.FinallyClause 141or SyntaxKind.CatchClause 142or SyntaxKind.SwitchSection) 148if (token.Parent.IsKind(SyntaxKind.SwitchStatement)) 155case SyntaxKind.ColonToken: 156return token.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel or SyntaxKind.LabeledStatement); 158case SyntaxKind.DoKeyword when token.Parent.IsKind(SyntaxKind.DoStatement): 161case SyntaxKind.CloseParenToken: 164is SyntaxKind.ForStatement 165or SyntaxKind.ForEachStatement 166or SyntaxKind.ForEachVariableStatement 167or SyntaxKind.WhileStatement 168or SyntaxKind.IfStatement 169or SyntaxKind.LockStatement 170or SyntaxKind.UsingStatement 171or SyntaxKind.FixedStatement; 173case SyntaxKind.ElseKeyword: 174return token.Parent.IsKind(SyntaxKind.ElseClause); 176case SyntaxKind.CloseBracketToken: 177if (token.Parent.IsKind(SyntaxKind.AttributeList)) 207if (token.Kind() == SyntaxKind.CloseBraceToken) 211memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 217if (token.Kind() == SyntaxKind.SemicolonToken) 230memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 250if (token.Kind() == SyntaxKind.CloseBracketToken) 259if (token.Parent.IsKind(SyntaxKind.AttributeList)) 272if (token.Kind() == SyntaxKind.CloseParenToken) 274if (token.Parent.IsKind(SyntaxKind.CastExpression)) 300if (token.Kind() == SyntaxKind.IdentifierToken && 301token.GetPreviousToken(includeSkipped: true).Kind() == SyntaxKind.IntoKeyword) 326if (targetToken.Kind() is SyntaxKind.IfKeyword or 327SyntaxKind.ElifKeyword) 333if (targetToken.Kind() == SyntaxKind.OpenParenToken && 334targetToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 363if (targetToken.Kind() is not (SyntaxKind.IdentifierToken or SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken)) 395if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 396targetToken.Parent.IsKind(SyntaxKind.SwitchStatement)) 401if (targetToken.Kind() == SyntaxKind.ColonToken) 403if (targetToken.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel)) 409if (targetToken.Kind() is SyntaxKind.SemicolonToken or 410SyntaxKind.CloseBraceToken) 430return targetToken.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken && 431targetToken.Parent is (kind: SyntaxKind.CrefBracketedParameterList or SyntaxKind.CrefParameterList); 449if (targetToken.Kind() == SyntaxKind.ColonToken && 450targetToken.Parent.IsKind(SyntaxKind.NameColon) && 451targetToken.Parent.Parent.IsKind(SyntaxKind.Argument) && 452targetToken.Parent.Parent.Parent.IsKind(SyntaxKind.ArgumentList)) 456is SyntaxKind.InvocationExpression 457or SyntaxKind.ObjectCreationExpression 458or SyntaxKind.BaseConstructorInitializer 459or SyntaxKind.ThisConstructorInitializer) 465if (targetToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 467if (targetToken.Parent.IsKind(SyntaxKind.ArgumentList)) 470is SyntaxKind.ObjectCreationExpression 471or SyntaxKind.BaseConstructorInitializer 472or SyntaxKind.ThisConstructorInitializer) 480if (targetToken.Parent.IsParentKind(SyntaxKind.InvocationExpression) && !targetToken.IsInvocationOfVarExpression()) 492if (targetToken.Kind() == SyntaxKind.OperatorKeyword && 504targetToken.GetAncestors<StatementSyntax>().Any(s => s.IsKind(SyntaxKind.UnsafeStatement)) || 505targetToken.GetAncestors<MemberDeclarationSyntax>().Any(m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword) || 506targetToken.GetAncestors<LocalFunctionStatementSyntax>().Any(f => f.GetModifiers().Any(SyntaxKind.UnsafeKeyword))) || 507targetToken.GetAncestors<UsingDirectiveSyntax>().Any(d => d.UnsafeKeyword.IsKind(SyntaxKind.UnsafeKeyword)); 515return targetToken.IsKindOrHasMatchingText(SyntaxKind.YieldKeyword); 518public static bool IsAnyAccessorDeclarationContext(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 525public static bool IsAccessorDeclarationContext<TMemberNode>(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 545if (existingAccessor.Kind() != SyntaxKind.None) 569while (targetToken.Kind() is SyntaxKind.InternalKeyword or 570SyntaxKind.PublicKeyword or 571SyntaxKind.ProtectedKeyword or 572SyntaxKind.PrivateKeyword or 573SyntaxKind.ReadOnlyKeyword) 580if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 581targetToken.Parent.IsKind(SyntaxKind.AccessorList)) 588if (targetToken.Kind() == SyntaxKind.CloseBraceToken && 589targetToken.Parent.IsKind(SyntaxKind.Block) && 596if (targetToken.Kind() == SyntaxKind.SemicolonToken && 603if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 604targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 615if (node.IsKind(SyntaxKind.TypeParameterList)) 617if (node?.Parent is TypeDeclarationSyntax(SyntaxKind.InterfaceDeclaration) typeDecl) 636if (targetToken.Kind() == SyntaxKind.LessThanToken && 642if (targetToken.Kind() == SyntaxKind.CommaToken && 648if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 649targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 650targetToken.Parent.Parent.IsKind(SyntaxKind.TypeParameter) && 661if (token.Kind() == SyntaxKind.CommaToken && token.Parent is BaseArgumentListSyntax)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (444)
21private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.ExternKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.AsyncKeyword, 26SyntaxKind.UnsafeKeyword, 36if (token.IsKind(SyntaxKind.OpenBracketToken) && 37token.Parent.IsKind(SyntaxKind.AttributeList)) 44if (token.IsKind(SyntaxKind.CommaToken) && 45token.Parent.IsKind(SyntaxKind.AttributeList)) 52if (token.IsKind(SyntaxKind.ColonToken) && 53token.Parent.IsKind(SyntaxKind.AttributeTargetSpecifier)) 60if (token.Parent.IsKind(SyntaxKind.QualifiedName) && 61token.Parent.IsParentKind(SyntaxKind.Attribute)) 68if (token.Parent.IsKind(SyntaxKind.AliasQualifiedName) && 69token.Parent.IsParentKind(SyntaxKind.Attribute)) 80ISet<SyntaxKind> validModifiers, 95if (token.IsKind(SyntaxKind.CloseBracketToken) 115if (parent.IsKind(SyntaxKind.CompilationUnit) || 116(parent is MemberDeclarationSyntax && parent.IsParentKind(SyntaxKind.CompilationUnit))) 129return kind is ((int)SyntaxKind.AssemblyKeyword) 130or ((int)SyntaxKind.ModuleKeyword); 166if (token.IsKind(SyntaxKind.OpenBraceToken)) 177if (token.IsKind(SyntaxKind.SemicolonToken)) 194if (token.IsKind(SyntaxKind.CloseBraceToken)) 208token.Parent.IsKind(SyntaxKind.Block) && 220if (token.IsKind(SyntaxKind.CloseBracketToken) && 221token.Parent.IsKind(SyntaxKind.AttributeList)) 243ISet<SyntaxKind>? validModifiers, 244ISet<SyntaxKind>? validTypeDeclarations, 257validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 285token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 294validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 299if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 322SyntaxKind otherModifier, 330return modifierTokens.Contains(otherModifier) && IsLambdaDeclarationContext(syntaxTree, position, SyntaxKind.None, cancellationToken); 342ISet<SyntaxKind> validModifiers, 359if (token.Kind() == SyntaxKind.CloseBracketToken && token.Parent is AttributeListSyntax) 420(nextToken.Kind() == SyntaxKind.GlobalKeyword && nextToken.GetAncestor<UsingDirectiveSyntax>()?.GlobalKeyword == nextToken)) 426if (token.IsKind(SyntaxKind.None)) 440if (token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent is NamespaceDeclarationSyntax or TypeDeclarationSyntax) 455if (token.IsKind(SyntaxKind.SemicolonToken)) 457if (token.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective)) 477if (token.IsKind(SyntaxKind.CloseBraceToken)) 483else if (token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 492token.Parent.IsKind(SyntaxKind.Block) && 507if (token.IsKind(SyntaxKind.CloseBracketToken) && 508token.Parent.IsKind(SyntaxKind.AttributeList)) 511if (token.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 532ISet<SyntaxKind>? validModifiers, 533ISet<SyntaxKind>? validTypeDeclarations, 543validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 576token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 591validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 602return incompleteMember.Type.IsKind(SyntaxKind.RefType); 609if (modifierTokens.Contains(SyntaxKind.FileKeyword)) 612if (modifierTokens.Contains(SyntaxKind.ClosedKeyword)) 638if (token.IsKind(SyntaxKind.ColonColonToken) && 639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.GlobalKeyword)) 651if (token.IsKind(SyntaxKind.UsingKeyword)) 656if (token.GetNextToken(includeSkipped: true).Kind() != SyntaxKind.EqualsToken && 701is SyntaxKind.ClassKeyword 702or SyntaxKind.StructKeyword 703or SyntaxKind.InterfaceKeyword && 704token.GetPreviousToken().IsKind(SyntaxKind.PartialKeyword)) 737syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 738syntaxTree.IsAfterKeyword(position, SyntaxKind.RefKeyword, cancellationToken) || 739syntaxTree.IsAfterKeyword(position, SyntaxKind.ReadOnlyKeyword, cancellationToken) || 740syntaxTree.IsAfterKeyword(position, SyntaxKind.CaseKeyword, cancellationToken) || 741syntaxTree.IsAfterKeyword(position, SyntaxKind.EventKeyword, cancellationToken) || 742syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) || 785if (token.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken && 801if (token.IsKind(SyntaxKind.EqualsToken) && 831if (token.IsKind(SyntaxKind.WhereKeyword) && 832token.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 837if (token.IsKind(SyntaxKind.IdentifierToken) && 838token.HasMatchingText(SyntaxKind.WhereKeyword) && 839token.Parent.IsKind(SyntaxKind.IdentifierName) && 840token.Parent.IsParentKind(SyntaxKind.SimpleBaseType) && 841token.Parent.Parent.IsParentKind(SyntaxKind.BaseList)) 858if (token.IsKind(SyntaxKind.ColonToken) && 859token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IdentifierToken) && 860token.GetPreviousToken(includeSkipped: true).GetPreviousToken().IsKind(SyntaxKind.WhereKeyword)) 884if (token.IsKind(SyntaxKind.CommaToken) && 903if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.TypeOfExpression)) 915if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.DefaultExpression)) 928if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.SizeOfExpression)) 947case SyntaxKind.LessThanToken: 948case SyntaxKind.CommaToken: 949return token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList); 955{ Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } => true, 957{ Parent: TypeSyntax { Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } } => true, 963=> targetToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause) && 964targetToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken; 980if (token.Kind() is not SyntaxKind.LessThanToken and not SyntaxKind.CommaToken) 1015if (name.IsParentKind(SyntaxKind.LessThanExpression) && 1017conditional.IsParentKind(SyntaxKind.ExpressionStatement) && 1018conditional.Parent.IsParentKind(SyntaxKind.GlobalStatement)) 1060out SyntaxKind previousModifier) 1069previousModifier = SyntaxKind.None; 1071if (token.IsKind(SyntaxKind.OpenParenToken) && 1079if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 1085if (token.IsKind(SyntaxKind.CommaToken) && 1095if (token.IsKind(SyntaxKind.CommaToken) && 1104if (token.IsKind(SyntaxKind.CloseBracketToken) && 1105token.Parent.IsKind(SyntaxKind.AttributeList) && 1115if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.ReadOnlyKeyword or SyntaxKind.OutKeyword or SyntaxKind.ThisKeyword or SyntaxKind.ParamsKeyword or SyntaxKind.ScopedKeyword) 1120else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName }) 1123previousModifier = SyntaxKind.ScopedKeyword; 1150if (syntaxTree.IsParameterModifierContext(position, tokenOnLeftOfPosition, includeOperators: false, out _, out var previousModifier) && 1151previousModifier == SyntaxKind.None) 1164if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken) 1166return token.Parent.IsKind(SyntaxKind.BracketedParameterList); 1178if (token.IsKind(SyntaxKind.DelegateKeyword) && 1179token.Parent.IsKind(SyntaxKind.DelegateDeclaration)) 1193if (token.IsKind(SyntaxKind.OperatorKeyword) && 1194token.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword) 1210if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 1211token.Parent is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList)) 1225typeDecl.IsKind(SyntaxKind.ClassDeclaration) && 1226method.Modifiers.Any(SyntaxKind.StaticKeyword) && 1227typeDecl.Modifiers.Any(SyntaxKind.StaticKeyword); 1236if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1238if (token.Parent.IsKind(SyntaxKind.ParameterList) && 1239token.Parent.IsParentKind(SyntaxKind.ParenthesizedLambdaExpression)) 1255if (token.Parent is (kind: SyntaxKind.ParenthesizedExpression or SyntaxKind.TupleExpression or SyntaxKind.CastExpression)) 1269if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1273else if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter)) 1277else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName } && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 1286return parent.IsKind(SyntaxKind.ParameterList) && parent.IsParentKind(SyntaxKind.AnonymousMethodExpression); 1295if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 1328if (leftToken.IsKind(SyntaxKind.CloseParenToken)) 1331SyntaxKind.ParenthesizedExpression or 1332SyntaxKind.TupleExpression or 1333SyntaxKind.TupleType)) 1345if (leftToken.IsKind(SyntaxKind.IdentifierToken)) 1356if (leftToken.IsKind(SyntaxKind.IdentifierToken) && 1357leftToken.Parent.IsKind(SyntaxKind.IdentifierName) && 1358leftToken.Parent.Parent is (kind: SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression)) 1374if (leftToken.IsKind(SyntaxKind.OpenParenToken)) 1384if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedPattern)) 1392if (leftToken.Kind() is SyntaxKind.CaseKeyword or SyntaxKind.IsKeyword) 1399if (leftToken.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 1406if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 1413if (leftToken.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.ListPattern)) 1420if (leftToken.IsKind(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern)) 1428if (leftToken.IsKind(SyntaxKind.ColonToken) && leftToken.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) && 1429leftToken.Parent.IsParentKind(SyntaxKind.Subpattern)) 1439if (leftToken.IsKindOrHasMatchingText(SyntaxKind.AndKeyword) || leftToken.IsKindOrHasMatchingText(SyntaxKind.OrKeyword)) 1446if (leftToken.IsKind(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern)) 1455if (leftToken.Kind() is SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken or SyntaxKind.LessThanToken or SyntaxKind.LessThanEqualsToken && 1456leftToken.Parent.IsKind(SyntaxKind.RelationalPattern)) 1472if (leftToken.IsKind(SyntaxKind.DotToken) || 1473leftToken.IsKind(SyntaxKind.MinusGreaterThanToken)) 1492return leftToken.Kind() is not (SyntaxKind.OrKeyword 1493or SyntaxKind.AndKeyword 1494or SyntaxKind.NotKeyword 1495or SyntaxKind.OpenParenToken 1496or SyntaxKind.ColonColonToken 1497or SyntaxKind.DotDotToken 1498or SyntaxKind.OpenBraceToken); 1534binaryExpressionSyntax.OperatorToken.IsKind(SyntaxKind.IsKeyword) && 1576if (possibleCommaOrParen.Kind() is not (SyntaxKind.OpenParenToken or SyntaxKind.CommaToken)) 1582SyntaxKind.ParenthesizedExpression or 1583SyntaxKind.TupleExpression or 1584SyntaxKind.TupleType or 1585SyntaxKind.CastExpression)) 1591if (possibleCommaOrParen.Parent.IsKind(SyntaxKind.ParameterList) && 1616if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation) || 1617leftToken.Parent.IsParentKind(SyntaxKind.ParenthesizedVariableDesignation)) 1637if (leftToken.IsKind(SyntaxKind.OpenParenToken) && leftToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1647if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.TupleExpression)) 1657if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1681if (node.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1687if (node.Parent.IsKind(SyntaxKind.Argument) && node.Parent.Parent.IsKind(SyntaxKind.TupleExpression)) 1699if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 1700leftToken.Parent.IsKind(SyntaxKind.ArgumentList) && 1793if (token.IsKind(SyntaxKind.ConstKeyword) && 1794token.Parent.IsKind(SyntaxKind.LocalDeclarationStatement)) 1803if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.ReadOnlyKeyword) 1806if (parent is (kind: SyntaxKind.RefType or SyntaxKind.RefExpression or SyntaxKind.LocalDeclarationStatement)) 1808if (parent.IsParentKind(SyntaxKind.VariableDeclaration) && 1810SyntaxKind.LocalDeclarationStatement or 1811SyntaxKind.ForStatement or 1812SyntaxKind.ForEachVariableStatement)) 1817if (parent.Parent is (kind: SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement)) 1825if (token.IsKind(SyntaxKind.OutKeyword) && 1837if (token.IsKind(SyntaxKind.OpenParenToken)) 1840if (previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword or SyntaxKind.UsingKeyword) 1846if (token.IsKind(SyntaxKind.UsingKeyword) && 1854if (token.IsKindOrHasMatchingText(SyntaxKind.FromKeyword) && 1861if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.JoinKeyword) && 1873if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax) 1879if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent is IncompleteMemberSyntax or ScopedTypeSyntax) 1896if (token.IsKind(SyntaxKind.OpenParenToken) && 1897token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.FixedKeyword)) 1913if (token.IsKind(SyntaxKind.OpenParenToken) && 1914token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CatchKeyword)) 1927if (token.Kind() is SyntaxKind.IsKeyword or SyntaxKind.AsKeyword) 1938if (token.IsKind(SyntaxKind.NewKeyword)) 1992if (token.IsKind(SyntaxKind.None)) 2042if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.OpenParenToken) && 2056if (token.IsKind(SyntaxKind.OpenParenToken) && 2057token.Parent.IsKind(SyntaxKind.CastExpression)) 2076if (token.IsKind(SyntaxKind.CaseKeyword) && 2077token.Parent.IsKind(SyntaxKind.GotoCaseStatement)) 2082if (token.IsKind(SyntaxKind.EqualsToken) && 2085if (equalsValue.IsParentKind(SyntaxKind.VariableDeclarator) && 2086equalsValue.Parent.IsParentKind(SyntaxKind.VariableDeclaration)) 2092return fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2099return localDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2104if (equalsValue.IsParentKind(SyntaxKind.EnumMemberDeclaration)) 2110if (equalsValue.IsParentKind(SyntaxKind.Parameter)) 2118if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList) && 2119token.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken) 2125if (token.IsKind(SyntaxKind.ColonToken) && 2126token.Parent.IsKind(SyntaxKind.NameColon) && 2127token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2133if (token.IsKind(SyntaxKind.EqualsToken) && 2134token.Parent.IsKind(SyntaxKind.NameEquals) && 2135token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2205is SyntaxKind.DotToken 2206or SyntaxKind.ColonColonToken 2207or SyntaxKind.MinusGreaterThanToken) 2214if (token.IsKind(SyntaxKind.EqualsToken)) 2216if (token.Parent.IsKind(SyntaxKind.NameEquals) && 2217token.Parent.IsParentKind(SyntaxKind.UsingDirective)) 2237is SyntaxKind.EqualsToken 2238or SyntaxKind.MinusEqualsToken 2239or SyntaxKind.AsteriskEqualsToken 2240or SyntaxKind.PlusEqualsToken 2241or SyntaxKind.SlashEqualsToken 2242or SyntaxKind.ExclamationEqualsToken 2243or SyntaxKind.CaretEqualsToken 2244or SyntaxKind.AmpersandEqualsToken 2245or SyntaxKind.BarEqualsToken 2246or SyntaxKind.PercentEqualsToken 2247or SyntaxKind.LessThanLessThanEqualsToken 2248or SyntaxKind.GreaterThanGreaterThanEqualsToken 2249or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken 2250or SyntaxKind.QuestionQuestionEqualsToken) 2256if (token.IsKind(SyntaxKind.OpenParenToken)) 2258if (token.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 2331if (token.IsKind(SyntaxKind.AsteriskToken) && semanticModel != null) 2348tokenOnLeftOfPosition.IsKind(SyntaxKind.IdentifierToken)) 2351if (previousToken.Kind() is SyntaxKind.AsteriskToken or SyntaxKind.QuestionToken && 2352previousToken.Parent?.Kind() is SyntaxKind.PointerType or SyntaxKind.NullableType) 2355if (type.IsParentKind(SyntaxKind.VariableDeclaration) && 2374if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2375token.Parent.IsKind(SyntaxKind.ArrayRankSpecifier)) 2382if (token.IsKind(SyntaxKind.DotDotToken) && 2383token.Parent.IsKind(SyntaxKind.RangeExpression) && 2390if (token.IsKind(SyntaxKind.QuestionToken) && 2399if (token.IsKind(SyntaxKind.ColonToken) && 2400token.Parent.IsKind(SyntaxKind.ConditionalExpression)) 2408if (token.IsKind(SyntaxKind.OpenParenToken)) 2410if (token.Parent is (kind: SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression)) 2419if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 2430if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2431token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.BracketedArgumentList or SyntaxKind.TupleExpression)) 2440if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 2442if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList)) 2453if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 2455if (token.Parent.IsKind(SyntaxKind.Argument)) 2459else if (token.Parent.IsKind(SyntaxKind.RefExpression)) 2463if (token.Parent.IsParentKind(SyntaxKind.ParenthesizedExpression)) 2473if (token.IsKind(SyntaxKind.ColonToken) && 2474token.Parent.IsKind(SyntaxKind.NameColon) && 2475token.Parent.IsParentKind(SyntaxKind.Argument)) 2481if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 2488if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2494if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2497if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().IsKind(SyntaxKind.EqualsToken)) 2524if (token.IsKind(SyntaxKind.SemicolonToken) && 2535if (token.IsKind(SyntaxKind.OpenParenToken) && 2544if (token.IsKind(SyntaxKind.CommaToken) && 2545token.Parent.IsKind(SyntaxKind.ForStatement)) 2554if (token.IsKind(SyntaxKind.InKeyword)) 2557SyntaxKind.ForEachStatement or 2558SyntaxKind.ForEachVariableStatement or 2559SyntaxKind.FromClause or 2560SyntaxKind.JoinClause)) 2568if (token.Kind() is SyntaxKind.OnKeyword or SyntaxKind.EqualsKeyword && 2569token.Parent.IsKind(SyntaxKind.JoinClause)) 2575if (token.IsKind(SyntaxKind.WhereKeyword) && 2576token.Parent.IsKind(SyntaxKind.WhereClause)) 2583if (token.Kind() is SyntaxKind.OrderByKeyword or SyntaxKind.CommaToken && 2584token.Parent.IsKind(SyntaxKind.OrderByClause)) 2590if (token.IsKind(SyntaxKind.SelectKeyword) && 2591token.Parent.IsKind(SyntaxKind.SelectClause)) 2598if (token.Kind() is SyntaxKind.GroupKeyword or SyntaxKind.ByKeyword && 2599token.Parent.IsKind(SyntaxKind.GroupClause)) 2607if (token.IsKind(SyntaxKind.ReturnKeyword)) 2609if (token.GetPreviousToken(includeSkipped: true).Kind() != SyntaxKind.OpenBracketToken) 2616if (token.IsKind(SyntaxKind.ThrowKeyword)) 2622if (token.IsKind(SyntaxKind.OpenParenToken) && 2623token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword)) 2632if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2638if (token.IsKind(SyntaxKind.OpenParenToken) && 2639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.LockKeyword)) 2645if (token.IsKind(SyntaxKind.OpenParenToken) && 2646token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IfKeyword)) 2652if (token.IsKind(SyntaxKind.OpenParenToken) && 2653token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword)) 2659if (token.IsKind(SyntaxKind.OpenParenToken) && 2660token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword)) 2666if (token.IsKind(SyntaxKind.OpenParenToken) && 2667token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword)) 2673if (token.IsKind(SyntaxKind.OpenParenToken) && 2674token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword)) 2680if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2697if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 2698token.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 2706if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2707token.Parent.IsKind(SyntaxKind.ListPattern)) 2715if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.DotDotToken or SyntaxKind.CommaToken && 2716token.Parent.IsKind(SyntaxKind.CollectionExpression)) 2724if (token.Kind() is SyntaxKind.DotDotToken && 2725token.Parent.IsKind(SyntaxKind.SpreadElement)) 2736if (token.IsKind(SyntaxKind.OpenBraceToken)) 2757if (token.IsKind(SyntaxKind.DotToken)) 2760if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2763while (parentMemberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2768if (parentMemberAccess.Parent.IsKind(SyntaxKind.Argument) && 2776if (token.Parent.IsKind(SyntaxKind.QualifiedName)) 2779while (parentQualifiedName.Parent.IsKind(SyntaxKind.QualifiedName)) 2784if (parentQualifiedName.Parent.IsKind(SyntaxKind.Argument) && 2795if (token.Parent.IsKind(SyntaxKind.ArgumentList) && 2829if (token.IsKind(SyntaxKind.NumericLiteralToken)) 2859if (type.Kind() is SyntaxKind.GenericName or SyntaxKind.AliasQualifiedName or SyntaxKind.PredefinedType) 2874if (token.IsKind(SyntaxKind.IdentifierToken) && 2875token.Parent.IsKind(SyntaxKind.IdentifierName) && 2876token.Parent.Parent is (kind: SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression)) 2882if (token.Kind() is SyntaxKind.IdentifierToken && 2883token.Parent.IsKind(SyntaxKind.IdentifierName)) 2885if (token.Parent.Parent is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword }) 2889if (token.Text == SyntaxFacts.GetText(SyntaxKind.AsyncKeyword)) 2907if (tokenBeforeName.Kind() == SyntaxKind.CaseKeyword) 2925case SyntaxKind.QualifiedName: 2927case SyntaxKind.AliasQualifiedName: 2929case SyntaxKind.SimpleMemberAccessExpression: 2958if (token.IsKind(SyntaxKind.CloseBraceToken)) 2964block.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.CatchClause) 2984if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CatchKeyword)) 2989if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CloseParenToken) && 2990token.Parent.IsKind(SyntaxKind.CatchDeclaration)) 3007targetToken is (kind: SyntaxKind.ColonToken or SyntaxKind.CommaToken) && 3018targetToken.IsKind(SyntaxKind.ColonToken) && 3019targetToken.Parent.IsKind(SyntaxKind.BaseList) && 3020targetToken.Parent.IsParentKind(SyntaxKind.EnumDeclaration); 3029if (!token.IsKind(SyntaxKind.DotToken)) 3035if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 3041token.Parent?.Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) binaryExpression && 3080return targetToken.IsKind(SyntaxKind.AsteriskToken) && 3081targetToken.GetPreviousToken().IsKind(SyntaxKind.DelegateKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (6)
30if (expression.IsKind(SyntaxKind.RefExpression)) 42if (expression.IsKind(SyntaxKind.ThrowExpression)) 58Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 60Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty)); 72Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 74Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (2)
43constraints.Add(ClassOrStructConstraint(SyntaxKind.ClassConstraint)); 51constraints.Add(ClassOrStructConstraint(SyntaxKind.StructConstraint));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
97if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.UnsafeKeyword)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
111SyntaxKind.SimpleMemberAccessExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\NameSyntaxExtensions.cs (4)
36is SyntaxKind.AliasQualifiedName 37or SyntaxKind.NameColon 38or SyntaxKind.NameEquals 39or SyntaxKind.TypeParameterConstraintClause)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SeparatedSyntaxListExtensions.cs (4)
12this SeparatedSyntaxList<T> separatedList, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken) 19this SeparatedSyntaxList<T> separatedList, int index, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (2)
23var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 47default, SyntaxKind.None, "@" + unescaped, unescaped, default);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTokenListExtensions.cs (1)
12public static IEnumerable<SyntaxToken> SkipKinds(this SyntaxTokenList tokenList, params SyntaxKind[] kinds)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTreeExtensions.cs (17)
58if (token.Kind() == SyntaxKind.None) 74case SyntaxKind.LessThanToken: 81if (token.Kind() == SyntaxKind.None) 92if (token.Kind() == SyntaxKind.IdentifierToken) 113case SyntaxKind.GreaterThanToken: 114case SyntaxKind.GreaterThanGreaterThanToken: 115case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 127case SyntaxKind.AsteriskToken: // for int* 128case SyntaxKind.QuestionToken: // for int? 129case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 130case SyntaxKind.ColonColonToken: // for global:: 131case SyntaxKind.CloseBracketToken: 132case SyntaxKind.OpenBracketToken: 133case SyntaxKind.DotToken: 134case SyntaxKind.IdentifierToken: 137case SyntaxKind.CommaToken: 162if (token.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (6)
74if (typeNode.Modifiers.Any(SyntaxKind.PartialKeyword)) 97private static SyntaxToken EnsureToken(SyntaxToken token, SyntaxKind kind, bool prependNewLineIfMissing = false, bool appendNewLineIfMissing = false) 99if (token.IsMissing || token.IsKind(SyntaxKind.None)) 111var openBrace = EnsureToken(typeDeclaration.OpenBraceToken, SyntaxKind.OpenBraceToken); 112var closeBrace = EnsureToken(typeDeclaration.CloseBraceToken, SyntaxKind.CloseBraceToken, appendNewLineIfMissing: true); 117if (addedBraces && typeDeclaration.SemicolonToken.IsKind(SyntaxKind.SemicolonToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (26)
50token.Kind() is SyntaxKind.EndOfFileToken or SyntaxKind.None || 58if (token.IsKind(SyntaxKind.CloseParenToken) && !token.Parent.IsKind(SyntaxKind.UsingStatement)) 63if (token.IsKind(SyntaxKind.ColonToken) && !token.Parent.IsKind(SyntaxKind.LabeledStatement) && token.Parent is not SwitchLabelSyntax) 67if (token.IsKind(SyntaxKind.OpenBraceToken) && !token.IsFirstTokenOnLine(documentSyntax.Text)) 129(token.IsKind(SyntaxKind.CloseBraceToken) && OnlySmartIndentCloseBrace(indentationOptions.AutoFormattingOptions)) || 130(token.IsKind(SyntaxKind.OpenBraceToken) && OnlySmartIndentOpenBrace(indentationOptions.AutoFormattingOptions)); 151if (token.Kind() != SyntaxKind.ElseKeyword || 199if (endToken.IsKind(SyntaxKind.OpenBraceToken)) 289if (tokenBeforeCaret.Kind() is SyntaxKind.CloseBraceToken or 290SyntaxKind.EndOfFileToken) 301internal static bool ValidSingleOrMultiCharactersTokenKind(char typedChar, SyntaxKind kind) 304'n' => kind is SyntaxKind.RegionKeyword or SyntaxKind.EndRegionKeyword, 305't' => kind is SyntaxKind.SelectKeyword, 306'e' => kind is SyntaxKind.WhereKeyword or SyntaxKind.ElseKeyword, 317is SyntaxKind.None 318or SyntaxKind.EndOfDirectiveToken 319or SyntaxKind.EndOfFileToken; 354if (currentToken.Kind() == SyntaxKind.OpenBraceToken && 356currentTokenParentParent.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression or SyntaxKind.AnonymousMethodExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\TypingFormattingRule.cs (1)
104while (node != null && node.Kind() != SyntaxKind.CompilationUnit)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (8)
79if (token.IsKind(SyntaxKind.None) || 89if (previousToken.Kind() == SyntaxKind.None || previousToken.IsMissing) 109return token.Kind() is SyntaxKind.None or SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken; 125node.IsKind(SyntaxKind.Interpolation)) 132!argument.Parent.IsKind(SyntaxKind.ThisConstructorInitializer) && 141constructorInitializer.ArgumentList.OpenParenToken.Kind() != SyntaxKind.None &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (22)
74Contract.ThrowIfTrue(token.Kind() == SyntaxKind.None); 81if (token.IsKind(SyntaxKind.MultiLineRawStringLiteralToken)) 120if (token.Kind() is SyntaxKind.InterpolatedMultiLineRawStringStartToken or SyntaxKind.InterpolatedStringTextToken 121|| token is { RawKind: (int)SyntaxKind.CloseBraceToken, Parent: InterpolationSyntax }) 125if (interpolatedExpression.StringStartToken.IsKind(SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 139if (!indenter.Root.FindToken(currentLine.Start, findInsideTrivia: true).IsKind(SyntaxKind.InterpolatedStringTextToken)) 175token.Kind() is SyntaxKind.InterpolatedVerbatimStringStartToken or SyntaxKind.InterpolatedStringTextToken || 176(token.IsKind(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation))) 240case SyntaxKind.SemicolonToken: 251case SyntaxKind.CloseBraceToken: 253if (token.Parent.IsKind(SyntaxKind.AccessorList) && 254token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration)) 265case SyntaxKind.OpenBraceToken: 270case SyntaxKind.ColonToken: 283case SyntaxKind.CloseBracketToken: 297case SyntaxKind.XmlTextLiteralToken: 302case SyntaxKind.CommaToken: 307case SyntaxKind.CloseParenToken: 309if (token.Parent.IsKind(SyntaxKind.ArgumentList))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpAddImportsService.cs (1)
103=> SyntaxFactory.AreEquivalent(a, b, kind => kind == SyntaxKind.NullableDirectiveTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
63(i == 0 && currentUsing.IsParentKind(SyntaxKind.FileScopedNamespaceDeclaration)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
78contextualKind: SyntaxKind.UnderscoreToken, 104kind: SyntaxKind.IsExpression, 251kind: SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (2)
85if (braces.openBrace.Kind() == SyntaxKind.None && 86braces.closeBrace.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (19)
67.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 109=> SyntaxFactory.YieldStatement(SyntaxKind.YieldReturnStatement, (ExpressionSyntax)expression); 126SyntaxKind.InterpolatedStringTextToken, 139SyntaxFactory.Token(default, SyntaxKind.InterpolatedStringTextToken, format, format, default)); 216=> SyntaxFactory.BinaryPattern(SyntaxKind.AndPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 242=> SyntaxFactory.BinaryPattern(SyntaxKind.OrPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 270return SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression); 276return SyntaxFactory.LiteralExpression(SyntaxKind.FalseLiteralExpression); 289SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal("0", 0)); 313SyntaxKind.SimpleMemberAccessExpression, 325is SyntaxKind.ThisExpression 326or SyntaxKind.BaseExpression 327or SyntaxKind.ParenthesizedExpression 328or SyntaxKind.SimpleMemberAccessExpression 329or SyntaxKind.InvocationExpression 330or SyntaxKind.ElementAccessExpression 331or SyntaxKind.MemberBindingExpression) 340=> CreateBinaryExpression(SyntaxKind.BitwiseOrExpression, left, right); 342public static SyntaxNode CreateBinaryExpression(SyntaxKind syntaxKind, SyntaxNode left, SyntaxNode right)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (81)
327if (argument.Parent.IsParentKind(SyntaxKind.ImplicitElementAccess) && 328argument.Parent.Parent.IsParentKind(SyntaxKind.SimpleAssignmentExpression) && 329argument.Parent.Parent.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression) && 350if (previousToken.IsKind(SyntaxKind.CommaToken)) 431if (previousToken.Kind() == SyntaxKind.NewKeyword && 432previousToken.GetPreviousToken().Kind() is SyntaxKind.EqualsToken or SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 518if (previousToken != argumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 548if (previousToken != attributeArgumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 822if (previousToken.HasValue && previousToken.Value.GetPreviousToken().Kind() == SyntaxKind.EqualsToken) 897if (previousToken != bracketedArgumentList.OpenBracketToken && previousToken.Kind() != SyntaxKind.CommaToken) 954if (binop.Kind() == SyntaxKind.CoalesceExpression) 962case SyntaxKind.LessThanLessThanToken: 963case SyntaxKind.GreaterThanGreaterThanToken: 964case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 965case SyntaxKind.LessThanLessThanEqualsToken: 966case SyntaxKind.GreaterThanGreaterThanEqualsToken: 967case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 979if (operatorToken.Kind() is SyntaxKind.AmpersandAmpersandToken or 980SyntaxKind.BarBarToken) 986if (binop.Kind() == SyntaxKind.SimpleAssignmentExpression && 1015if (operatorToken.Kind() is SyntaxKind.AmpersandToken or 1016SyntaxKind.AmpersandEqualsToken or 1017SyntaxKind.BarToken or 1018SyntaxKind.BarEqualsToken or 1019SyntaxKind.CaretToken or 1020SyntaxKind.CaretEqualsToken) 1031if (operatorToken.Kind() == SyntaxKind.PlusToken) 1046case SyntaxKind.BarToken: 1047case SyntaxKind.CaretToken: 1048case SyntaxKind.AmpersandToken: 1049case SyntaxKind.LessThanToken: 1050case SyntaxKind.LessThanEqualsToken: 1051case SyntaxKind.GreaterThanToken: 1052case SyntaxKind.GreaterThanEqualsToken: 1053case SyntaxKind.PlusToken: 1054case SyntaxKind.MinusToken: 1055case SyntaxKind.AsteriskToken: 1056case SyntaxKind.SlashToken: 1057case SyntaxKind.PercentToken: 1058case SyntaxKind.CaretEqualsToken: 1059case SyntaxKind.PlusEqualsToken: 1060case SyntaxKind.MinusEqualsToken: 1061case SyntaxKind.AsteriskEqualsToken: 1062case SyntaxKind.SlashEqualsToken: 1063case SyntaxKind.PercentEqualsToken: 1064case SyntaxKind.LessThanLessThanToken: 1065case SyntaxKind.GreaterThanGreaterThanToken: 1066case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 1067case SyntaxKind.LessThanLessThanEqualsToken: 1068case SyntaxKind.GreaterThanGreaterThanEqualsToken: 1069case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 1072case SyntaxKind.BarEqualsToken: 1073case SyntaxKind.AmpersandEqualsToken: 1224if (equalsValue.IsParentKind(SyntaxKind.Parameter) && 1381if (initializerExpression.IsKind(SyntaxKind.ComplexElementInitializerExpression)) 1401else if (initializerExpression.IsKind(SyntaxKind.CollectionInitializerExpression)) 1423foreach (var sibling in initializerExpression.Expressions.Where(e => e.Kind() != SyntaxKind.ComplexElementInitializerExpression)) 1492else if (initializerExpression.IsParentKind(SyntaxKind.SimpleAssignmentExpression)) 1582if (identifier.HasMatchingText(SyntaxKind.OrKeyword) || 1583identifier.HasMatchingText(SyntaxKind.AndKeyword)) 1703var isAsync = anonymousFunction.AsyncKeyword.Kind() != SyntaxKind.None; 1807memberAccessExpression.Parent.IsParentKind(SyntaxKind.AwaitExpression)) 1831if (ienumerableType != null && memberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression, out invocation)) 1973case SyntaxKind.PostDecrementExpression: 1974case SyntaxKind.PostIncrementExpression: 1988case SyntaxKind.PreDecrementExpression: 1989case SyntaxKind.PreIncrementExpression: 1990case SyntaxKind.UnaryPlusExpression: 1991case SyntaxKind.UnaryMinusExpression: 1995case SyntaxKind.BitwiseNotExpression: 2007case SyntaxKind.LogicalNotExpression: 2011case SyntaxKind.AddressOfExpression: 2062if (previousToken.HasValue && (previousToken.Value != yieldStatement.ReturnOrBreakKeyword || yieldStatement.ReturnOrBreakKeyword.IsKind(SyntaxKind.BreakKeyword))) 2180if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2192switchLabel.Kind() != SyntaxKind.CaseSwitchLabel) 2211.FirstOrDefault(label => label.Kind() == SyntaxKind.CaseSwitchLabel) is CaseSwitchLabelSyntax firstCase) 2270if (variableDeclaration.IsParentKind(SyntaxKind.UsingStatement)) 2274if (variableDeclaration.IsParentKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
276.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (5)
23if (SyntaxFacts.GetKeywordKind(syntaxToken.ValueText) == SyntaxKind.None && SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.None) 28if (SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.UnderscoreToken) 34if (parentOfToken is SimpleNameSyntax && parent.Kind() == SyntaxKind.XmlNameAttribute) 41if (parent.Kind() == SyntaxKind.AliasQualifiedName &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NameSyntaxIterator.cs (1)
27if (currentNode.Kind() == SyntaxKind.QualifiedName)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\SyntaxKindSet.cs (101)
11public static readonly ISet<SyntaxKind> AllTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 13SyntaxKind.AbstractKeyword, 15SyntaxKind.ClosedKeyword, 17SyntaxKind.FileKeyword, 18SyntaxKind.InternalKeyword, 19SyntaxKind.NewKeyword, 20SyntaxKind.PublicKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.ProtectedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.ReadOnlyKeyword, 27SyntaxKind.RefKeyword 30public static readonly ISet<SyntaxKind> AllMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 32SyntaxKind.AbstractKeyword, 33SyntaxKind.AsyncKeyword, 34SyntaxKind.ExternKeyword, 35SyntaxKind.InternalKeyword, 36SyntaxKind.NewKeyword, 37SyntaxKind.OverrideKeyword, 38SyntaxKind.PublicKeyword, 39SyntaxKind.PrivateKeyword, 40SyntaxKind.ProtectedKeyword, 41SyntaxKind.ReadOnlyKeyword, 42SyntaxKind.RequiredKeyword, 43SyntaxKind.SealedKeyword, 44SyntaxKind.StaticKeyword, 45SyntaxKind.UnsafeKeyword, 46SyntaxKind.VirtualKeyword, 47SyntaxKind.VolatileKeyword, 50public static readonly ISet<SyntaxKind> AllGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 52SyntaxKind.ExternKeyword, 53SyntaxKind.InternalKeyword, 54SyntaxKind.NewKeyword, 55SyntaxKind.OverrideKeyword, 56SyntaxKind.PublicKeyword, 57SyntaxKind.PrivateKeyword, 58SyntaxKind.ReadOnlyKeyword, 59SyntaxKind.StaticKeyword, 60SyntaxKind.UnsafeKeyword, 61SyntaxKind.VolatileKeyword, 64public static readonly ISet<SyntaxKind> AccessibilityModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 66SyntaxKind.PublicKeyword, 67SyntaxKind.PrivateKeyword, 68SyntaxKind.ProtectedKeyword, 69SyntaxKind.InternalKeyword, 72public static readonly ISet<SyntaxKind> AllTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 74SyntaxKind.InterfaceDeclaration, 75SyntaxKind.ClassDeclaration, 76SyntaxKind.RecordDeclaration, 77SyntaxKind.StructDeclaration, 78SyntaxKind.RecordStructDeclaration, 80SyntaxKind.UnionDeclaration, 82SyntaxKind.EnumDeclaration, 85public static readonly ISet<SyntaxKind> ClassInterfaceStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 87SyntaxKind.InterfaceDeclaration, 88SyntaxKind.ClassDeclaration, 89SyntaxKind.RecordDeclaration, 90SyntaxKind.StructDeclaration, 91SyntaxKind.RecordStructDeclaration, 93SyntaxKind.UnionDeclaration, 97public static readonly ISet<SyntaxKind> NonEnumTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 99SyntaxKind.ClassDeclaration, 101SyntaxKind.ExtensionBlockDeclaration, 102SyntaxKind.UnionDeclaration, 104SyntaxKind.InterfaceDeclaration, 105SyntaxKind.RecordDeclaration, 106SyntaxKind.RecordStructDeclaration, 107SyntaxKind.StructDeclaration, 110public static readonly ISet<SyntaxKind> ClassInterfaceRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 112SyntaxKind.InterfaceDeclaration, 113SyntaxKind.ClassDeclaration, 114SyntaxKind.RecordDeclaration, 117public static readonly ISet<SyntaxKind> ClassRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 119SyntaxKind.ClassDeclaration, 120SyntaxKind.RecordDeclaration, 123public static readonly ISet<SyntaxKind> ClassStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 125SyntaxKind.ClassDeclaration, 126SyntaxKind.RecordDeclaration, 127SyntaxKind.StructDeclaration, 128SyntaxKind.RecordStructDeclaration, 130SyntaxKind.UnionDeclaration, 134public static readonly ISet<SyntaxKind> StructOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 136SyntaxKind.StructDeclaration, 137SyntaxKind.RecordStructDeclaration, 139SyntaxKind.UnionDeclaration, 143public static readonly ISet<SyntaxKind> InterfaceOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 145SyntaxKind.InterfaceDeclaration,
Microsoft.CodeAnalysis.Razor.Compiler (214)
CSharp\GlobalQualifiedTypeNameRewriter.cs (1)
98return SyntaxFactory.AliasQualifiedName(SyntaxFactory.IdentifierName(SyntaxFactory.Token(CSharp.SyntaxKind.GlobalKeyword)), node);
Language\CodeGeneration\CodeWriterExtensions.cs (2)
596return CodeAnalysis.CSharp.SyntaxFacts.GetKeywordKind(identifier) != CodeAnalysis.CSharp.SyntaxKind.None || 597CodeAnalysis.CSharp.SyntaxFacts.GetContextualKeywordKind(identifier) != CodeAnalysis.CSharp.SyntaxKind.None;
Language\Intermediate\CommonModifiers.cs (26)
6using CSharpSyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; 12private static string GetText(CSharpSyntaxKind kind) 16GetText(CSharpSyntaxKind.InternalKeyword)]; 19GetText(CSharpSyntaxKind.InternalKeyword), 20GetText(CSharpSyntaxKind.SealedKeyword)]; 23GetText(CSharpSyntaxKind.InternalKeyword), 24GetText(CSharpSyntaxKind.StaticKeyword)]; 27GetText(CSharpSyntaxKind.PrivateKeyword)]; 30GetText(CSharpSyntaxKind.PrivateKeyword), 31GetText(CSharpSyntaxKind.ReadOnlyKeyword)]; 34GetText(CSharpSyntaxKind.PrivateKeyword), 35GetText(CSharpSyntaxKind.SealedKeyword)]; 38GetText(CSharpSyntaxKind.FileKeyword), 39GetText(CSharpSyntaxKind.SealedKeyword)]; 42GetText(CSharpSyntaxKind.ProtectedKeyword)]; 45GetText(CSharpSyntaxKind.ProtectedKeyword), 46GetText(CSharpSyntaxKind.OverrideKeyword)]; 49GetText(CSharpSyntaxKind.PublicKeyword)]; 52GetText(CSharpSyntaxKind.PublicKeyword), 53GetText(CSharpSyntaxKind.AsyncKeyword), 54GetText(CSharpSyntaxKind.OverrideKeyword)]; 57GetText(CSharpSyntaxKind.PublicKeyword), 58GetText(CSharpSyntaxKind.OverrideKeyword), 59GetText(CSharpSyntaxKind.AsyncKeyword)]; 62GetText(CSharpSyntaxKind.PublicKeyword), 63GetText(CSharpSyntaxKind.PartialKeyword)];
Language\Legacy\CSharpCodeParser.cs (57)
15using CSharpSyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; 79private static readonly CSharpSyntaxKind[] s_conditionalBlockKeywordKinds = [ 80CSharpSyntaxKind.ForKeyword, 81CSharpSyntaxKind.ForEachKeyword, 82CSharpSyntaxKind.WhileKeyword, 83CSharpSyntaxKind.SwitchKeyword, 84CSharpSyntaxKind.LockKeyword]; 86private static readonly CSharpSyntaxKind[] s_caseStatementKeywordKinds = [ 87CSharpSyntaxKind.CaseKeyword, 88CSharpSyntaxKind.DefaultKeyword]; 90private static readonly CSharpSyntaxKind[] s_ifStatementKeywordKinds = [ 91CSharpSyntaxKind.IfKeyword]; 93private static readonly CSharpSyntaxKind[] s_tryStatementKeywordKinds = [ 94CSharpSyntaxKind.TryKeyword]; 96private static readonly CSharpSyntaxKind[] s_doStatementKeywordKinds = [ 97CSharpSyntaxKind.DoKeyword]; 99private static readonly CSharpSyntaxKind[] s_usingKeywordKinds = [ 100CSharpSyntaxKind.UsingKeyword]; 115private readonly Dictionary<CSharpSyntaxKind, Action<SyntaxListBuilder<RazorSyntaxNode>, CSharpTransitionSyntax?>> _keywordParserMap; 154var keywordParserMap = new Dictionary<CSharpSyntaxKind, Action<SyntaxListBuilder<RazorSyntaxNode>, CSharpTransitionSyntax?>>(capacity: s_initialKeywordCount + 1); 182CSharpSyntaxKind[] keywords) 184foreach (var keyword in keywords) 197keywordParserMap.Add(CSharpSyntaxKind.AwaitKeyword, ParseAwaitExpression); 1724string.Equals(CurrentToken.Content, CSharpSyntaxFacts.GetText(CSharpSyntaxKind.WhereKeyword), StringComparison.Ordinal)) 1769CSharpSyntaxFacts.GetText(CSharpSyntaxKind.WhereKeyword))); 2108return _tokenizer.Tokenizer.GetTokenKeyword(CurrentToken) is CSharpSyntaxKind.TrueKeyword or CSharpSyntaxKind.FalseKeyword; 2114Assert(CSharpSyntaxKind.AwaitKeyword); 2133if (At(CSharpSyntaxKind.ForEachKeyword)) 2260Debug.Assert(result is CSharpSyntaxKind.CaseKeyword or CSharpSyntaxKind.DefaultKeyword); 2282Assert(CSharpSyntaxKind.IfKeyword); 2299if (At(CSharpSyntaxKind.ElseKeyword)) 2302Assert(CSharpSyntaxKind.ElseKeyword); 2316if (!At(CSharpSyntaxKind.ElseKeyword)) 2324if (At(CSharpSyntaxKind.IfKeyword)) 2340Assert(CSharpSyntaxKind.TryKeyword); 2362if (At(CSharpSyntaxKind.CatchKeyword)) 2365Assert(CSharpSyntaxKind.CatchKeyword); 2369else if (At(CSharpSyntaxKind.FinallyKeyword)) 2372Assert(CSharpSyntaxKind.FinallyKeyword); 2386Assert(CSharpSyntaxKind.CatchKeyword); 2399if (At(CSharpSyntaxKind.WhenKeyword)) 2421Assert(CSharpSyntaxKind.DoKeyword); 2442if (At(CSharpSyntaxKind.WhileKeyword)) 2445Assert(CSharpSyntaxKind.WhileKeyword); 2462Assert(CSharpSyntaxKind.UsingKeyword); 2470var atStaticOrGlobal = At(CSharpSyntaxKind.StaticKeyword, CSharpSyntaxKind.GlobalKeyword); 2532Assert(CSharpSyntaxKind.UsingKeyword); 2559Assert(CSharpSyntaxKind.UsingKeyword); 2565if (At(SyntaxKind.Identifier) || At(CSharpSyntaxKind.GlobalKeyword)) 2590else if (At(CSharpSyntaxKind.StaticKeyword)) 3068internal void Assert(CSharpSyntaxKind expectedKeyword) 3076protected internal bool At(params ReadOnlySpan<CSharpSyntaxKind> keywords) 3084foreach (var search in keywords) 3098if (result is not CSharpSyntaxKind.None and { } value && token.Kind == SyntaxKind.Keyword)
Language\Legacy\CSharpTokenizer.cs (2)
5using CSharpSyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; 15internal abstract CSharpSyntaxKind? GetTokenKeyword(SyntaxToken token);
Language\Legacy\NativeCSharpTokenizer.cs (84)
14using CSharpSyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; 26private static readonly FrozenDictionary<string, CSharpSyntaxKind> _keywords = (new[] { 27CSharpSyntaxKind.AwaitKeyword, 28CSharpSyntaxKind.AbstractKeyword, 29CSharpSyntaxKind.ByteKeyword, 30CSharpSyntaxKind.ClassKeyword, 31CSharpSyntaxKind.DelegateKeyword, 32CSharpSyntaxKind.EventKeyword, 33CSharpSyntaxKind.FixedKeyword, 34CSharpSyntaxKind.IfKeyword, 35CSharpSyntaxKind.InternalKeyword, 36CSharpSyntaxKind.NewKeyword, 37CSharpSyntaxKind.OverrideKeyword, 38CSharpSyntaxKind.ReadOnlyKeyword, 39CSharpSyntaxKind.ShortKeyword, 40CSharpSyntaxKind.StructKeyword, 41CSharpSyntaxKind.TryKeyword, 42CSharpSyntaxKind.UnsafeKeyword, 43CSharpSyntaxKind.VolatileKeyword, 44CSharpSyntaxKind.AsKeyword, 45CSharpSyntaxKind.DoKeyword, 46CSharpSyntaxKind.IsKeyword, 47CSharpSyntaxKind.ParamsKeyword, 48CSharpSyntaxKind.RefKeyword, 49CSharpSyntaxKind.SwitchKeyword, 50CSharpSyntaxKind.UShortKeyword, 51CSharpSyntaxKind.WhileKeyword, 52CSharpSyntaxKind.CaseKeyword, 53CSharpSyntaxKind.ConstKeyword, 54CSharpSyntaxKind.ExplicitKeyword, 55CSharpSyntaxKind.FloatKeyword, 56CSharpSyntaxKind.NullKeyword, 57CSharpSyntaxKind.SizeOfKeyword, 58CSharpSyntaxKind.TypeOfKeyword, 59CSharpSyntaxKind.ImplicitKeyword, 60CSharpSyntaxKind.PrivateKeyword, 61CSharpSyntaxKind.ThisKeyword, 62CSharpSyntaxKind.UsingKeyword, 63CSharpSyntaxKind.ExternKeyword, 64CSharpSyntaxKind.ReturnKeyword, 65CSharpSyntaxKind.StackAllocKeyword, 66CSharpSyntaxKind.UIntKeyword, 67CSharpSyntaxKind.BaseKeyword, 68CSharpSyntaxKind.CatchKeyword, 69CSharpSyntaxKind.ContinueKeyword, 70CSharpSyntaxKind.DoubleKeyword, 71CSharpSyntaxKind.ForKeyword, 72CSharpSyntaxKind.InKeyword, 73CSharpSyntaxKind.LockKeyword, 74CSharpSyntaxKind.ObjectKeyword, 75CSharpSyntaxKind.ProtectedKeyword, 76CSharpSyntaxKind.StaticKeyword, 77CSharpSyntaxKind.FalseKeyword, 78CSharpSyntaxKind.PublicKeyword, 79CSharpSyntaxKind.SByteKeyword, 80CSharpSyntaxKind.ThrowKeyword, 81CSharpSyntaxKind.VirtualKeyword, 82CSharpSyntaxKind.DecimalKeyword, 83CSharpSyntaxKind.ElseKeyword, 84CSharpSyntaxKind.OperatorKeyword, 85CSharpSyntaxKind.StringKeyword, 86CSharpSyntaxKind.ULongKeyword, 87CSharpSyntaxKind.BoolKeyword, 88CSharpSyntaxKind.CharKeyword, 89CSharpSyntaxKind.DefaultKeyword, 90CSharpSyntaxKind.ForEachKeyword, 91CSharpSyntaxKind.LongKeyword, 92CSharpSyntaxKind.VoidKeyword, 93CSharpSyntaxKind.EnumKeyword, 94CSharpSyntaxKind.FinallyKeyword, 95CSharpSyntaxKind.IntKeyword, 96CSharpSyntaxKind.OutKeyword, 97CSharpSyntaxKind.SealedKeyword, 98CSharpSyntaxKind.TrueKeyword, 99CSharpSyntaxKind.GotoKeyword, 100CSharpSyntaxKind.UncheckedKeyword, 101CSharpSyntaxKind.InterfaceKeyword, 102CSharpSyntaxKind.BreakKeyword, 103CSharpSyntaxKind.CheckedKeyword, 104CSharpSyntaxKind.NamespaceKeyword, 105CSharpSyntaxKind.WhenKeyword, 106CSharpSyntaxKind.WhereKeyword }).ToFrozenDictionary(keySelector: k => SyntaxFacts.GetText(k)); 768internal override CSharpSyntaxKind? GetTokenKeyword(SyntaxToken token) 770if (token != null && _keywords.TryGetValue(token.Content, out var keyword))
Language\Legacy\RoslynCSharpTokenizer.cs (42)
15using CSharpSyntaxKind = Microsoft.CodeAnalysis.CSharp.SyntaxKind; 220Debug.Assert(leadingTriviaResult.ContextualKind == CSharpSyntaxKind.None); 221Debug.Assert(leadingTriviaResult.Token.IsKind(CSharpSyntaxKind.None)); 315Debug.Assert(nextResult.Token.IsKind(CSharpSyntaxKind.None)); 329(int)CSharpSyntaxKind.ExclamationToken => SyntaxKind.Not, 330(int)CSharpSyntaxKind.OpenParenToken => SyntaxKind.LeftParenthesis, 331(int)CSharpSyntaxKind.CloseParenToken => SyntaxKind.RightParenthesis, 332(int)CSharpSyntaxKind.CommaToken => SyntaxKind.Comma, 333(int)CSharpSyntaxKind.DotToken => SyntaxKind.Dot, 334(int)CSharpSyntaxKind.ColonColonToken => SyntaxKind.DoubleColon, 335(int)CSharpSyntaxKind.ColonToken => SyntaxKind.Colon, 336(int)CSharpSyntaxKind.OpenBraceToken => SyntaxKind.LeftBrace, 337(int)CSharpSyntaxKind.CloseBraceToken => SyntaxKind.RightBrace, 338(int)CSharpSyntaxKind.LessThanToken => SyntaxKind.LessThan, 339(int)CSharpSyntaxKind.GreaterThanToken => SyntaxKind.GreaterThan, 340(int)CSharpSyntaxKind.EqualsToken => SyntaxKind.Assign, 341(int)CSharpSyntaxKind.OpenBracketToken => SyntaxKind.LeftBracket, 342(int)CSharpSyntaxKind.CloseBracketToken => SyntaxKind.RightBracket, 343(int)CSharpSyntaxKind.QuestionToken => SyntaxKind.QuestionMark, 344(int)CSharpSyntaxKind.SemicolonToken => SyntaxKind.Semicolon, 345<= (int)CSharpSyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken and >= (int)CSharpSyntaxKind.TildeToken => SyntaxKind.CSharpOperator, 481if (trivia.IsKind(CSharpSyntaxKind.MultiLineCommentTrivia) && triviaString.StartsWith("@*", StringComparison.Ordinal)) 495&& trivia.Kind() is CSharpSyntaxKind.MultiLineCommentTrivia or CSharpSyntaxKind.MultiLineDocumentationCommentTrivia 506case CSharpSyntaxKind.WhitespaceTrivia: 509case CSharpSyntaxKind.EndOfLineTrivia: 513case CSharpSyntaxKind.SkippedTokensTrivia: 532case CSharpSyntaxKind.SingleLineCommentTrivia or 533CSharpSyntaxKind.MultiLineCommentTrivia or 534CSharpSyntaxKind.MultiLineDocumentationCommentTrivia or 535CSharpSyntaxKind.SingleLineDocumentationCommentTrivia: 559_isOnlyWhitespaceOnLine = directiveTrivia.EndOfDirectiveToken.TrailingTrivia is [.., { RawKind: (int)CSharpSyntaxKind.EndOfLineTrivia }]; 561case CSharpSyntaxKind.DisabledTextTrivia: 634case CSharpSyntaxKind.ConflictMarkerTrivia: 675if (!csharpToken.IsKind(CSharpSyntaxKind.IdentifierToken) || result.ContextualKind is not (CSharpSyntaxKind.None or CSharpSyntaxKind.IdentifierToken)) 708internal override CSharpSyntaxKind? GetTokenKeyword(SyntaxToken token) 712return CSharpSyntaxKind.None; 716return SyntaxFacts.GetKeywordKind(content) is var kind and not CSharpSyntaxKind.None 746if (!nextResult.Token.IsKind(CSharpSyntaxKind.None))
Microsoft.DotNet.CodeAnalysis (7)
Analyzers\AppContextDefaultsAnalyzer.cs (6)
57context.RegisterSyntaxNodeAction(AnalyzeCodeBlock, SyntaxKind.InvocationExpression); 74if (args.Expression.Kind() != SyntaxKind.TrueLiteralExpression) 80var containingIfStatement = call.Ancestors().FirstOrDefault(n => n.IsKind(SyntaxKind.IfStatement)) as IfStatementSyntax; 88if (!(containingIfStatement.Parent.IsKind(SyntaxKind.SwitchSection) || 89containingIfStatement.Parent.Parent.IsKind(SyntaxKind.SwitchSection))) 96if (containingIfStatement.Condition.Kind() != SyntaxKind.LessThanOrEqualExpression)
Analyzers\ResourceUsageAnalyzer.cs (1)
30context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.InvocationExpression);
Microsoft.DotNet.ProjectTools (8)
src\sdk\src\Cli\Microsoft.DotNet.FileBasedPrograms\FileLevelDirectiveHelpers.cs (8)
69while (!result.Token.IsKind(SyntaxKind.EndOfFileToken)); 74if (trivia.ContainsDiagnostics && trivia.IsKind(SyntaxKind.IgnoredDirectiveTrivia)) 104if (trivia.IsKind(SyntaxKind.WhitespaceTrivia)) 111if (trivia.IsKind(SyntaxKind.ShebangDirectiveTrivia)) 125else if (trivia.IsKind(SyntaxKind.IgnoredDirectiveTrivia)) 129var message = trivia.GetStructure() is IgnoredDirectiveTriviaSyntax { Content: { RawKind: (int)SyntaxKind.StringLiteralToken } content } 202if (trivia.IsKind(SyntaxKind.EndOfLineTrivia)) 213if (trivia.IsKind(SyntaxKind.WhitespaceTrivia))
Microsoft.Extensions.Logging.Generators (6)
LoggerMessageGenerator.Parser.cs (6)
298if (mod.IsKind(SyntaxKind.PartialKeyword)) 302else if (mod.IsKind(SyntaxKind.StaticKeyword)) 590static bool IsAllowedKind(SyntaxKind kind) => 591kind == SyntaxKind.ClassDeclaration || 592kind == SyntaxKind.StructDeclaration || 593kind == SyntaxKind.RecordDeclaration;
Microsoft.Extensions.Options.SourceGeneration (9)
Parser.cs (8)
161private static bool IsAllowedKind(SyntaxKind kind) => 162kind == SyntaxKind.ClassDeclaration || 163kind == SyntaxKind.StructDeclaration || 164kind == SyntaxKind.RecordStructDeclaration || 165kind == SyntaxKind.RecordDeclaration; 180SyntaxKind.ClassDeclaration => "class", 181SyntaxKind.RecordDeclaration => "record class", 182SyntaxKind.RecordStructDeclaration => "record struct",
ParserUtilities.cs (1)
33internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Gen.BuildMetadata (2)
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
src\Generators\Shared\ParserUtilities.cs (1)
38internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Gen.ComplianceReports (2)
Parser.cs (1)
39foreach (TypeDeclarationSyntax typeSyntax in typeForSyntaxTree.Where(n => !n.IsKind(SyntaxKind.InterfaceDeclaration)))
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
Microsoft.Gen.ContextualOptions (4)
Parser.cs (3)
31.Where(modifier => modifier.IsKind(SyntaxKind.StaticKeyword)) 45.Where(modifier => modifier.IsKind(SyntaxKind.RefKeyword)) 54if (!type.Definitions.Any(def => def.Modifiers.Any(static token => token.IsKind(SyntaxKind.PartialKeyword))))
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
EmitterTests.cs (1)
39mod => mod.IsKind(SyntaxKind.ReadOnlyKeyword));
Microsoft.Gen.Logging (8)
Parsing\Parser.cs (5)
332static bool IsAllowedKind(SyntaxKind kind) => 333kind == SyntaxKind.ClassDeclaration || 334kind == SyntaxKind.StructDeclaration || 335kind == SyntaxKind.RecordDeclaration; 460if (trivia.IsKind(SyntaxKind.SingleLineDocumentationCommentTrivia))
Parsing\Parser.LogProperties.cs (1)
241if (ParserUtilities.PropertyHasModifier(property, SyntaxKind.NewKeyword, _cancellationToken))
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
src\Generators\Shared\ParserUtilities.cs (1)
38internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Gen.Logging.Unit.Tests (8)
ParserUtilitiesTests.cs (8)
22SyntaxFactory.Token(SyntaxKind.PublicKeyword), 23SyntaxFactory.Token(SyntaxKind.StaticKeyword), 24SyntaxFactory.Token(SyntaxKind.PartialKeyword)), 33SyntaxFactory.Token(SyntaxKind.ProtectedKeyword), 34SyntaxFactory.Token(SyntaxKind.VirtualKeyword)), 53var result = ParserUtilities.PropertyHasModifier(symbolMock.Object, SyntaxKind.ProtectedKeyword, CancellationToken.None); 62SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.PartialKeyword)), 74var result = ParserUtilities.PropertyHasModifier(symbolMock.Object, SyntaxKind.ProtectedKeyword, CancellationToken.None);
Microsoft.Gen.MetadataExtractor (9)
src\Generators\Microsoft.Gen.ComplianceReports\Parser.cs (1)
39foreach (TypeDeclarationSyntax typeSyntax in typeForSyntaxTree.Where(n => !n.IsKind(SyntaxKind.InterfaceDeclaration)))
src\Generators\Microsoft.Gen.Metrics\Parser.cs (6)
82foreach (var memberSyntax in typeDeclaration.Members.Where(x => x.IsKind(SyntaxKind.MethodDeclaration))) 150static bool IsAllowedKind(SyntaxKind kind) => 151kind is SyntaxKind.ClassDeclaration or 152SyntaxKind.StructDeclaration or 153SyntaxKind.RecordDeclaration; 193if (typeDeclaration.IsKind(SyntaxKind.RecordStructDeclaration) &&
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
src\Generators\Shared\ParserUtilities.cs (1)
38internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Gen.Metrics (8)
Parser.cs (6)
82foreach (var memberSyntax in typeDeclaration.Members.Where(x => x.IsKind(SyntaxKind.MethodDeclaration))) 150static bool IsAllowedKind(SyntaxKind kind) => 151kind is SyntaxKind.ClassDeclaration or 152SyntaxKind.StructDeclaration or 153SyntaxKind.RecordDeclaration; 193if (typeDeclaration.IsKind(SyntaxKind.RecordStructDeclaration) &&
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
src\Generators\Shared\ParserUtilities.cs (1)
38internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Gen.MetricsReports (8)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (6)
82foreach (var memberSyntax in typeDeclaration.Members.Where(x => x.IsKind(SyntaxKind.MethodDeclaration))) 150static bool IsAllowedKind(SyntaxKind kind) => 151kind is SyntaxKind.ClassDeclaration or 152SyntaxKind.StructDeclaration or 153SyntaxKind.RecordDeclaration; 193if (typeDeclaration.IsKind(SyntaxKind.RecordStructDeclaration) &&
src\Generators\Shared\GeneratorUtilities.cs (1)
87if (node.IsKind(SyntaxKind.Attribute))
src\Generators\Shared\ParserUtilities.cs (1)
38internal static bool PropertyHasModifier(ISymbol property, SyntaxKind modifierToSearch, CancellationToken token)
Microsoft.Interop.ComInterfaceGenerator (51)
Analyzers\AddMarshalAsToElementFixer.cs (1)
58if (node.IsKind(SyntaxKind.MethodDeclaration))
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (2)
215if (expression.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 220if (expression.IsKind(SyntaxKind.GenericName))
Analyzers\VtableIndexStubDiagnosticsAnalyzer.cs (3)
113|| methodSyntax.Modifiers.Any(SyntaxKind.StaticKeyword) 114|| methodSyntax.Modifiers.Any(SyntaxKind.SealedKeyword)) 122if (!typeDecl.Modifiers.Any(SyntaxKind.PartialKeyword))
ComInterfaceGenerator.cs (5)
366new SyntaxTokenList(syntax.Modifiers.Where(static m => !m.IsKind(SyntaxKind.NewKeyword) && !m.IsKind(SyntaxKind.PartialKeyword) && !m.IsKind(SyntaxKind.VirtualKeyword))).StripAccessibilityModifiers(), 367SyntaxKind.MethodDeclaration, 620writer.WriteLine($"{string.Join(" ", syntax.Modifiers.AddToModifiers(SyntaxKind.UnsafeKeyword))} {syntax.TypeKind.GetDeclarationKeyword()} {syntax.Identifier}{syntax.TypeParameters}");
ComInterfaceGeneratorHelpers.cs (1)
46literals[i] = ExpressionElement(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(bytes[i])));
ComMethodInfo.cs (2)
72|| comMethodDeclaringSyntax.Modifiers.Any(SyntaxKind.SealedKeyword)) 151bool shadowsBaseMethod = comMethodDeclaringSyntax.Modifiers.Any(SyntaxKind.NewKeyword);
Marshallers\ComInterfaceDispatchMarshallingResolver.cs (2)
51AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 54MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
Marshallers\IidParameterIndexMarshallerResolver.cs (22)
53VariableDeclaration(PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword)))) 59PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword))), 62SyntaxKind.SimpleMemberAccessExpression, 70SyntaxKind.NotEqualsExpression, 72LiteralExpression(SyntaxKind.NullLiteralExpression)), 80LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0)))))), 82VariableDeclaration(PredefinedType(Token(SyntaxKind.IntKeyword))) 89SyntaxKind.SimpleMemberAccessExpression, 94Argument(iidExpression).WithRefKindKeyword(Token(SyntaxKind.InKeyword)), 95Argument(IdentifierName(queriedInterfaceIdentifier)).WithRefKindKeyword(Token(SyntaxKind.OutKeyword))))))), 99SyntaxKind.SimpleMemberAccessExpression, 106SyntaxKind.LessThanExpression, 108LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0))), 112SyntaxKind.NotEqualsExpression, 114LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0))), 118SyntaxKind.SimpleMemberAccessExpression, 125SyntaxKind.SimpleAssignmentExpression, 127LiteralExpression(SyntaxKind.NullLiteralExpression))), 139SyntaxKind.SimpleAssignmentExpression, 142PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword))), 148SyntaxKind.SimpleAssignmentExpression, 150LiteralExpression(SyntaxKind.NullLiteralExpression))))));
Marshallers\ManagedHResultExceptionGeneratorResolver.cs (3)
87SyntaxKind.SimpleAssignmentExpression, 90SyntaxKind.NumericLiteralExpression, 95SyntaxKind.SemicolonToken,
VirtualMethodPointerStubGenerator.cs (7)
75Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(methodStub.VtableIndexData.Index)))), 110FunctionPointerCallingConvention(Token(SyntaxKind.UnmanagedKeyword), callConv.IsEmpty ? null : FunctionPointerUnmanagedCallingConventionList(SeparatedList(callConv))), 145MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 159InitializerExpression(SyntaxKind.CollectionInitializerExpression, 167.WithModifiers(TokenList(Token(SyntaxKind.InternalKeyword), Token(SyntaxKind.StaticKeyword))) 254FunctionPointerCallingConvention(Token(SyntaxKind.UnmanagedKeyword), callConv.IsEmpty ? null : FunctionPointerUnmanagedCallingConventionList(SeparatedList(callConv))),
VtableIndexStubGenerator.cs (3)
347var methodSyntaxTemplate = new ContainingSyntax(new SyntaxTokenList(syntax.Modifiers.Where(static m => !m.IsKind(SyntaxKind.PartialKeyword) && !m.IsKind(SyntaxKind.VirtualKeyword))).StripAccessibilityModifiers(), SyntaxKind.MethodDeclaration, syntax.Identifier, syntax.TypeParameterList);
Microsoft.Interop.JavaScript.JSImportGenerator (90)
Analyzers\JSImportExportDiagnosticsAnalyzer.cs (2)
157bool isPartial = methodSyntax.Modifiers.Any(SyntaxKind.PartialKeyword); 163|| !methodSyntax.Modifiers.Any(SyntaxKind.StaticKeyword)
JSExportGenerator.cs (34)
120MemberDeclarationSyntax wrappperMethod = MethodDeclaration(PredefinedType(Token(SyntaxKind.VoidKeyword)), Identifier(wrapperName)) 121.WithModifiers(TokenList(new[] { Token(SyntaxKind.InternalKeyword), Token(SyntaxKind.StaticKeyword), Token(SyntaxKind.UnsafeKeyword) })) 178var methodSyntaxTemplate = new ContainingSyntax(originalSyntax.Modifiers, SyntaxKind.MethodDeclaration, originalSyntax.Identifier, originalSyntax.TypeParameterList); 208FieldDeclarationSyntax field = FieldDeclaration(VariableDeclaration(PredefinedType(Token(SyntaxKind.BoolKeyword))) 211.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) 215MemberDeclarationSyntax method = MethodDeclaration(PredefinedType(Token(SyntaxKind.VoidKeyword)), Identifier(initializerName)) 217.WithModifiers(TokenList(new[] { Token(SyntaxKind.StaticKeyword) })) 221MemberDeclarationSyntax initializerMethod = MethodDeclaration(PredefinedType(Token(SyntaxKind.VoidKeyword)), Identifier(trimmingPreserveName)) 229Token(SyntaxKind.CommaToken), 238SyntaxKind.BitwiseOrExpression, 240SyntaxKind.SimpleMemberAccessExpression, 244SyntaxKind.SimpleMemberAccessExpression, 247Token(SyntaxKind.CommaToken), 249LiteralExpression(SyntaxKind.StringLiteralExpression, Literal($"{generatedNamespace}.{initializerClass}")) 251Token(SyntaxKind.CommaToken), 253LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(assemblyName)) 257Token(SyntaxKind.StaticKeyword), 258Token(SyntaxKind.InternalKeyword) 267Token(SyntaxKind.UnsafeKeyword)})) 280BinaryExpression(SyntaxKind.LogicalOrExpression, 282BinaryExpression(SyntaxKind.NotEqualsExpression, 287AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 289LiteralExpression(SyntaxKind.TrueLiteralExpression))), 348AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(wrapperName))), 349AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(incrementalContext.SignatureContext.StubTypeFullName))), 350AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(incrementalContext.SignatureContext.AssemblyName))), 377LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(nativeArg.NativeIndex + 2)))))))); 387SyntaxKind.AddExpression, 389LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(1))))); 413Argument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(context.QualifiedMethodName))), 414Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(context.TypesHash))), 418return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
JSImportGenerator.cs (11)
102.AddModifiers(Token(SyntaxKind.StaticKeyword)); 161var methodSyntaxTemplate = new ContainingSyntax(originalSyntax.Modifiers, SyntaxKind.MethodDeclaration, originalSyntax.Identifier, originalSyntax.TypeParameterList); 265Argument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(jsImportData.FunctionName))), 268? LiteralExpression(SyntaxKind.NullLiteralExpression) 269: LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(jsImportData.ModuleName))), 273return IfStatement(BinaryExpression(SyntaxKind.EqualsExpression, IdentifierName(signatureContext.BindingName), LiteralExpression(SyntaxKind.NullLiteralExpression)), 275ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 277InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 310LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(1))))))) 324hasReturn ? jsMarshalerArgument : PredefinedType(Token(SyntaxKind.VoidKeyword)),
JSManagedTypeInfo.cs (12)
22Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.VoidKeyword)) 27Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.BoolKeyword)) 32Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ByteKeyword)) 37Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.CharKeyword)) 42Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ShortKeyword)) 47Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.IntKeyword)) 52Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.LongKeyword)) 57Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.FloatKeyword)) 62Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.DoubleKeyword)) 88Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.ObjectKeyword)) 93Syntax = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.StringKeyword)) 119return new JSTaskTypeInfo(new JSSimpleTypeInfo(KnownManagedType.Void, SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.VoidKeyword))));
Marshaling\BaseJSGenerator.cs (1)
49.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword))))
Marshaling\FuncJSGenerator.cs (11)
53List<ArgumentSyntax> arguments = [source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword))]; 67return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 88return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 94.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) 97.WithModifiers(TokenList(Token(SyntaxKind.RefKeyword))) 102InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 109.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) 112.WithModifiers(TokenList(Token(SyntaxKind.RefKeyword))) 115.WithModifiers(TokenList(Token(SyntaxKind.OutKeyword))) 118InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 121Argument(IdentifierName("__delegate_arg"+(i+1))).WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)),
Marshaling\ImplicitArgumentGenerator.cs (2)
26.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))), 31MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
Marshaling\PrimitiveJSGenerator.cs (3)
39return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 41.WithArgumentList(ArgumentList(SingletonSeparatedList(source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))))); 46return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
Marshaling\TaskJSGenerator.cs (14)
56return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 58.WithArgumentList(ArgumentList(SingletonSeparatedList(source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))))); 63return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 70return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 73source.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)), 75.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) 78.WithModifiers(TokenList(Token(SyntaxKind.RefKeyword))) 81.WithModifiers(TokenList(Token(SyntaxKind.OutKeyword))) 84InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 87Argument(IdentifierName("__task_result")).WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)), 93return ExpressionStatement(InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 98.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword))) 101.WithModifiers(TokenList(Token(SyntaxKind.RefKeyword))) 106InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
Microsoft.Interop.LibraryImportGenerator (35)
Analyzers\ConvertToLibraryImportFixer.cs (14)
334else if (invocation.Parent.IsKind(SyntaxKind.ExpressionStatement)) 345SyntaxKind.UnderscoreToken, 349.WithRefKindKeyword(SyntaxFactory.Token(SyntaxKind.OutKeyword))), 354else if (invocation.Parent.IsKind(SyntaxKind.EqualsValueClause)) 357if (declaration.IsKind(SyntaxKind.FieldDeclaration) || declaration.IsKind(SyntaxKind.EventFieldDeclaration)) 382.WithRefKindKeyword(SyntaxFactory.Token(SyntaxKind.OutKeyword))), 387else if (invocation.Parent.IsKind(SyntaxKind.SimpleAssignmentExpression) && invocation.Parent.Parent.IsKind(SyntaxKind.ExpressionStatement)) 397.WithRefKindKeyword(SyntaxFactory.Token(SyntaxKind.OutKeyword))), 521if (attrArg.Expression.IsKind(SyntaxKind.StringLiteralExpression)) 528SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, 538SyntaxFactory.BinaryExpression(SyntaxKind.AddExpression, 540SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression,
Analyzers\LibraryImportDiagnosticsAnalyzer.cs (2)
324|| !methodSyntax.Modifiers.Any(SyntaxKind.StaticKeyword) 325|| !methodSyntax.Modifiers.Any(SyntaxKind.PartialKeyword))
LibraryImportGenerator.cs (19)
107InitializerExpressionSyntax callConvs = InitializerExpression(SyntaxKind.ArrayInitializerExpression); 131LiteralExpression(SyntaxKind.NumericLiteralExpression, 268var methodSyntaxTemplate = new ContainingSyntax(originalSyntax.Modifiers, SyntaxKind.MethodDeclaration, originalSyntax.Identifier, originalSyntax.TypeParameterList); 352modifiers = modifiers.AddToModifiers(SyntaxKind.ExternKeyword); 357.WithSemicolonToken(Token(SyntaxKind.SemicolonToken)) 381SyntaxKind.StringLiteralExpression, 387SyntaxKind.StringLiteralExpression, 392LiteralExpression(SyntaxKind.TrueLiteralExpression)) 410Token(SyntaxKind.StaticKeyword), 411Token(SyntaxKind.ExternKeyword), 412Token(SyntaxKind.UnsafeKeyword)) 413.WithSemicolonToken(Token(SyntaxKind.SemicolonToken)) 424localDllImport = localDllImport.AddAttributeLists(returnTypeAttributes.WithTarget(AttributeTargetSpecifier(Token(SyntaxKind.ReturnKeyword)))); 434SyntaxKind.StringLiteralExpression, 443LiteralExpression(SyntaxKind.TrueLiteralExpression)) 470? SyntaxKind.TrueLiteralExpression 471: SyntaxKind.FalseLiteralExpression); 477SyntaxKind.StringLiteralExpression, 485SyntaxKind.SimpleMemberAccessExpression,
Microsoft.Interop.LibraryImportGenerator.Downlevel (20)
DownlevelLibraryImportDiagnosticsAnalyzer.cs (2)
328|| !methodSyntax.Modifiers.Any(SyntaxKind.StaticKeyword) 329|| !methodSyntax.Modifiers.Any(SyntaxKind.PartialKeyword))
DownlevelLibraryImportGenerator.cs (18)
121LiteralExpression(SyntaxKind.NumericLiteralExpression, 229var methodSyntaxTemplate = new ContainingSyntax(originalSyntax.Modifiers, SyntaxKind.MethodDeclaration, originalSyntax.Identifier, originalSyntax.TypeParameterList); 300modifiers = modifiers.AddToModifiers(SyntaxKind.ExternKeyword); 305.WithSemicolonToken(Token(SyntaxKind.SemicolonToken)) 326SyntaxKind.StringLiteralExpression, 332SyntaxKind.StringLiteralExpression, 337LiteralExpression(SyntaxKind.TrueLiteralExpression)) 355Token(SyntaxKind.StaticKeyword), 356Token(SyntaxKind.ExternKeyword), 357Token(SyntaxKind.UnsafeKeyword)) 358.WithSemicolonToken(Token(SyntaxKind.SemicolonToken)) 369localDllImport = localDllImport.AddAttributeLists(returnTypeAttributes.WithTarget(AttributeTargetSpecifier(Token(SyntaxKind.ReturnKeyword)))); 379SyntaxKind.StringLiteralExpression, 388LiteralExpression(SyntaxKind.TrueLiteralExpression)) 415? SyntaxKind.TrueLiteralExpression 416: SyntaxKind.FalseLiteralExpression); 422SyntaxKind.StringLiteralExpression, 430SyntaxKind.SimpleMemberAccessExpression,
Microsoft.Interop.SourceGeneration (169)
ContainingSyntaxContext.cs (5)
16public readonly struct ContainingSyntax(SyntaxTokenList modifiers, SyntaxKind typeKind, SyntaxToken identifier, TypeParameterListSyntax? typeParameters) : IEquatable<ContainingSyntax> 22public SyntaxKind TypeKind { get; init; } = typeKind; 113type = type.WithModifiers(type.Modifiers.AddToModifiers(SyntaxKind.UnsafeKeyword)); 139type = type.WithModifiers(type.Modifiers.AddToModifiers(SyntaxKind.UnsafeKeyword)); 172writer.WriteLine($"{string.Join(" ", syntax.Modifiers.AddToModifiers(SyntaxKind.UnsafeKeyword))} {syntax.TypeKind.GetDeclarationKeyword()} {syntax.Identifier}{syntax.TypeParameters}");
GeneratedStatements.cs (2)
119SyntaxKind.SimpleAssignmentExpression, 147SyntaxKind.SimpleAssignmentExpression,
IndentedTextWriterExtensions.cs (2)
18if (leadingTrivia.IsKind(SyntaxKind.EndOfLineTrivia)) 31if (trailingTrivia.IsKind(SyntaxKind.EndOfLineTrivia))
ManagedToNativeStubGenerator.cs (4)
121PredefinedType(Token(SyntaxKind.IntKeyword)), 128setupStatements.Add(Declare(PredefinedType(Token(SyntaxKind.BoolKeyword)), InvokeSucceededIdentifier, initializeToDefault: true)); 157tryStatements.Add(ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 159LiteralExpression(SyntaxKind.TrueLiteralExpression))));
MarshalAsParser.cs (8)
50LiteralExpression(SyntaxKind.NumericLiteralExpression, 75LiteralExpression(SyntaxKind.NumericLiteralExpression, 85LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(paramIndex)))); 112LiteralExpression(SyntaxKind.NumericLiteralExpression, 122LiteralExpression(SyntaxKind.NumericLiteralExpression, 133LiteralExpression(SyntaxKind.NumericLiteralExpression, 141LiteralExpression(SyntaxKind.NumericLiteralExpression, 304&& parameterSyntax.Modifiers.IndexOf(SyntaxKind.OutKeyword) >= 0;
Marshalling\BlittableMarshaller.cs (3)
54PrefixUnaryExpression(SyntaxKind.AddressOfExpression, 76SyntaxKind.SimpleAssignmentExpression, 87SyntaxKind.SimpleAssignmentExpression,
Marshalling\BoolMarshaller.cs (8)
64SyntaxKind.SimpleAssignmentExpression, 70LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(_trueValue)), 71LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(_falseValue))))))); 81(SyntaxKind binaryOp, int comparand) = _compareToTrue ? (SyntaxKind.EqualsExpression, _trueValue) : (SyntaxKind.NotEqualsExpression, _falseValue); 85SyntaxKind.SimpleAssignmentExpression, 90LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(comparand)))));
Marshalling\CharMarshaller.cs (5)
58PointerType(PredefinedType(Token(SyntaxKind.CharKeyword))), 63SyntaxKind.AddressOfExpression, 97SyntaxKind.SimpleAssignmentExpression, 109SyntaxKind.SimpleAssignmentExpression, 113Token(SyntaxKind.CharKeyword)),
Marshalling\DelegateMarshaller.cs (6)
46SyntaxKind.NotEqualsExpression, 48LiteralExpression(SyntaxKind.NullLiteralExpression) 54LiteralExpression(SyntaxKind.DefaultLiteralExpression))); 65SyntaxKind.NotEqualsExpression, 67LiteralExpression(SyntaxKind.DefaultLiteralExpression)), 76LiteralExpression(SyntaxKind.NullLiteralExpression)));
Marshalling\ElementsMarshalling.cs (22)
68SizeAndParamIndexInfo(int size, TypePositionInfo param) => CheckedExpression(SyntaxKind.CheckedExpression, 69BinaryExpression(SyntaxKind.AddExpression, 78if (numElementsExpression.IsKind(SyntaxKind.CheckedExpression)) 82numElementsExpression = CheckedExpression(SyntaxKind.CheckedExpression, 84PredefinedType(Token(SyntaxKind.IntKeyword)), 92return LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(size)); 118SyntaxKind.SimpleAssignmentExpression, 121SyntaxKind.SimpleMemberAccessExpression, 132SyntaxKind.SimpleAssignmentExpression, 135SyntaxKind.SimpleMemberAccessExpression, 162MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 198MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 206SyntaxKind.SimpleMemberAccessExpression, 285MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 312MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 359MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 372indexConstraintName = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 386if (contentsCleanupStatements.IsKind(SyntaxKind.EmptyStatement)) 465MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 581PrefixUnaryExpression(SyntaxKind.PreIncrementExpression, 616PredefinedType(Token(SyntaxKind.IntKeyword)), 621EqualsValueClause(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0)))))))
Marshalling\MarshallerHelpers.cs (17)
49Argument(LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(errorCode)))); 244.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)))); 251LiteralExpression(SyntaxKind.DefaultLiteralExpression, Token(SyntaxKind.DefaultKeyword))); 260LiteralExpression(SyntaxKind.DefaultLiteralExpression, Token(SyntaxKind.DefaultKeyword))); 392tokens = tokens.Add(Token(SyntaxKind.ScopedKeyword)); 400tokens = tokens.Add(Token(SyntaxKind.InKeyword)); 403tokens = tokens.Add(Token(SyntaxKind.RefKeyword)); 407tokens = tokens.Add(Token(SyntaxKind.OutKeyword)); 410tokens = tokens.Add(Token(SyntaxKind.RefKeyword)); 411tokens = tokens.Add(Token(SyntaxKind.ReadOnlyKeyword)); 420tokens = tokens.Add(Token(SyntaxKind.ThisKeyword)); 431RefKind.In => Token(SyntaxKind.InKeyword), 432RefKind.Ref => Token(SyntaxKind.RefKeyword), 433RefKind.Out => Token(SyntaxKind.OutKeyword), 434RefKind.RefReadOnlyParameter => Token(SyntaxKind.InKeyword),
Marshalling\MarshallingGeneratorExtensions.cs (2)
148ValueBoundaryBehavior.AddressOfNativeIdentifier => Argument(PrefixUnaryExpression(SyntaxKind.AddressOfExpression, IdentifierName(nativeIdentifier))), 169return RefExpression(PrefixUnaryExpression(SyntaxKind.PointerIndirectionExpression, IdentifierName(paramIdentifier)));
Marshalling\StatefulMarshallingStrategy.cs (5)
142declaration = declaration.AddModifiers(Token(SyntaxKind.ScopedKeyword)); 220MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 333if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement)) 347if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement)) 402PredefinedType(Token(SyntaxKind.IntKeyword)),
Marshalling\StatelessMarshallingStrategy.cs (37)
41SyntaxKind.SimpleAssignmentExpression, 44MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 60MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 82assignment = AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 90SyntaxKind.SimpleAssignmentExpression, 113SyntaxKind.SimpleAssignmentExpression, 116MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 183MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 197SyntaxKind.SimpleAssignmentExpression, 200MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 208.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)) 222SyntaxKind.SimpleAssignmentExpression, 225MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 269MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 288MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 329SyntaxKind.SimpleAssignmentExpression, 350SyntaxKind.SimpleAssignmentExpression, 365SyntaxKind.SimpleAssignmentExpression, 372SyntaxKind.SimpleAssignmentExpression, 375MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 400SyntaxKind.SimpleAssignmentExpression, 403MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 410.WithRefOrOutKeyword(Token(SyntaxKind.OutKeyword)) 424PredefinedType(Token(SyntaxKind.IntKeyword)), 453SyntaxKind.SimpleAssignmentExpression, 460SyntaxKind.SimpleAssignmentExpression, 463MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, 490SyntaxKind.SimpleMemberAccessExpression, 506SyntaxKind.SimpleMemberAccessExpression, 521SyntaxKind.SimpleMemberAccessExpression, 538SyntaxKind.SimpleMemberAccessExpression, 574if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement)) 590SyntaxKind.SimpleAssignmentExpression, 592LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(0)))); 599SyntaxKind.SimpleAssignmentExpression, 624if (!elementCleanup.IsKind(SyntaxKind.EmptyStatement)) 633SyntaxKind.SimpleAssignmentExpression,
Marshalling\StaticPinnableManagedValueMarshaller.cs (4)
31&& predefinedType.Keyword.IsKind(SyntaxKind.VoidKeyword)) 81PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword))), 85PrefixUnaryExpression(SyntaxKind.AddressOfExpression, 87MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression,
Marshalling\UnmanagedToManagedOwnershipTrackingStrategy.cs (4)
43AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, 45LiteralExpression(SyntaxKind.TrueLiteralExpression))); 62PredefinedType(Token(SyntaxKind.BoolKeyword)), 68LiteralExpression(SyntaxKind.FalseLiteralExpression))))));
SignatureContext.cs (2)
78AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(generatorName))), 79AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(generatorVersion)))
SyntaxExtensions.cs (12)
18if (fixedStatement.Statement.IsKind(SyntaxKind.EmptyStatement)) 24if (fixedStatement.Statement.IsKind(SyntaxKind.Block)) 37if (childStatement.IsKind(SyntaxKind.Block)) 66if (statement.IsKind(SyntaxKind.Block)) 89if (tokenList[i].Kind() is SyntaxKind.PublicKeyword or SyntaxKind.InternalKeyword or SyntaxKind.ProtectedKeyword or SyntaxKind.PrivateKeyword) 98public static SyntaxTokenList AddToModifiers(this SyntaxTokenList modifiers, SyntaxKind modifierToAdd) 106int idxPartial = modifiers.IndexOf(SyntaxKind.PartialKeyword); 107int idxRef = modifiers.IndexOf(SyntaxKind.RefKeyword); 124if (!typeDecl.Modifiers.Any(SyntaxKind.PartialKeyword))
SyntaxKindExtensions.cs (6)
10public static string GetDeclarationKeyword(this SyntaxKind syntaxKind) => syntaxKind switch 12SyntaxKind.ClassDeclaration => "class", 13SyntaxKind.StructDeclaration => "struct", 14SyntaxKind.InterfaceDeclaration => "interface", 15SyntaxKind.RecordDeclaration => "record", 16SyntaxKind.RecordStructDeclaration => "record struct",
TypeNames.cs (1)
46public static TypeSyntax VoidStar { get; } = PointerType(PredefinedType(Token(SyntaxKind.VoidKeyword)));
TypePositionInfo.cs (1)
94IsExplicitThis = ((ParameterSyntax?)paramSymbol.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax())?.Modifiers.Any(SyntaxKind.ThisKeyword) ?? false
Utils\SyntaxFactoryExtensions.cs (13)
20return Declare(typeSyntax, identifier, initializeToDefault ? LiteralExpression(SyntaxKind.DefaultLiteralExpression) : null); 50SyntaxKind.SimpleMemberAccessExpression, 58SyntaxKind.SimpleMemberAccessExpression, 72=> Argument(null, Token(SyntaxKind.RefKeyword), expression); 75=> Argument(null, Token(SyntaxKind.InKeyword), expression); 78=> Argument(null, Token(SyntaxKind.OutKeyword), expression); 88SyntaxKind.SimpleMemberAccessExpression, 97public static LiteralExpressionSyntax IntLiteral(int number) => LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(number)); 105=> ExpressionStatement(AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, left, right)); 122Token(SyntaxKind.IntKeyword))) 130SyntaxKind.NumericLiteralExpression, 134SyntaxKind.LessThanExpression, 140SyntaxKind.PreIncrementExpression,
Microsoft.Maui.Controls.BindingSourceGen (3)
BindingSourceGenerator.cs (2)
181 if (!lambda.Modifiers.Any(SyntaxKind.StaticKeyword)) 254 BinaryExpressionSyntax binary when binary.Kind() == SyntaxKind.AsExpression => binary.Left,
PathParser.cs (1)
29 BinaryExpressionSyntax asExpression when asExpression.Kind() == SyntaxKind.AsExpression => HandleBinaryExpression(asExpression),
Microsoft.Maui.Controls.SourceGen (2)
CodeBehindGenerator.cs (2)
98 var kind = SyntaxFacts.GetKeywordKind(identifier); 99 return kind == SyntaxKind.None
Microsoft.ML.AutoML (2)
Utils\Entity.cs (2)
148if (exp.Kind() == SyntaxKind.AddExpression) 156else if (exp.Kind() == SyntaxKind.MultiplyExpression)
Microsoft.ML.InternalCodeAnalyzer (40)
BestFriendAnalyzer.cs (3)
66foreach (var node in model.SyntaxTree.GetRoot().DescendantNodes(n => !n.IsKind(SyntaxKind.UsingDirective))) 71case SyntaxKind.BaseConstructorInitializer: 72case SyntaxKind.IdentifierName:
ContractsCheckAnalyzer.cs (9)
93context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.InvocationExpression); 141if (exp.IsKind(SyntaxKind.AddExpression)) 149if (exp.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 156if (exp.IsKind(SyntaxKind.InvocationExpression)) 159return exp.IsKind(SyntaxKind.StringLiteralExpression) || exp.IsKind(SyntaxKind.IdentifierName); 164while (node != null && !node.IsKind(SyntaxKind.MethodDeclaration) && !node.IsKind(SyntaxKind.ConstructorDeclaration)) 209if (isExcept && invocation.Parent.IsKind(SyntaxKind.ExpressionStatement))
ContractsCheckNameofFixProvider.cs (7)
50Debug.Assert(nameArg.Parent.Parent.IsKind(SyntaxKind.InvocationExpression)); 74.Select(p => p.Parent).Where(n => n.IsKind(SyntaxKind.IdentifierName)); 78var pk = node.Parent.Kind(); 79if (pk == SyntaxKind.SimpleMemberAccessExpression) 84else if (pk == SyntaxKind.QualifiedName) 108while (temp != null && !temp.IsKind(SyntaxKind.MethodDeclaration) && !temp.IsKind(SyntaxKind.ConstructorDeclaration))
InstanceInitializerAnalyzer.cs (1)
72if (!syntax.ChildNodes().Any(s => s.IsKind(SyntaxKind.EqualsValueClause)))
NameAnalyzer.cs (15)
79context.RegisterSyntaxNodeAction(AnalyzeField, SyntaxKind.FieldDeclaration); 80context.RegisterSyntaxNodeAction(AnalyzeField, SyntaxKind.EventFieldDeclaration); 81context.RegisterSyntaxNodeAction(AnalyzeClass, SyntaxKind.ClassDeclaration); 82context.RegisterSyntaxNodeAction(AnalyzeEnum, SyntaxKind.EnumDeclaration); 83context.RegisterSyntaxNodeAction(AnalyzeEnumMember, SyntaxKind.EnumMemberDeclaration); 84context.RegisterSyntaxNodeAction(AnalyzeEvent, SyntaxKind.EventDeclaration); 85context.RegisterSyntaxNodeAction(AnalyzeMethod, SyntaxKind.MethodDeclaration); 86context.RegisterSyntaxNodeAction(AnalyzeNamespace, SyntaxKind.NamespaceDeclaration); 87context.RegisterSyntaxNodeAction(AnalyzeProperty, SyntaxKind.PropertyDeclaration); 88context.RegisterSyntaxNodeAction(AnalyzeStruct, SyntaxKind.StructDeclaration); 131return modifiers.Any(token => token.IsKind(SyntaxKind.ExternKeyword)); 151if (mod.IsKind(SyntaxKind.ConstKeyword)) 153else if (mod.IsKind(SyntaxKind.PublicKeyword) || mod.IsKind(SyntaxKind.ProtectedKeyword) || mod.IsKind(SyntaxKind.InternalKeyword))
ParameterVariableNameAnalyzer.cs (2)
37context.RegisterSyntaxNodeAction(AnalyzeParameter, SyntaxKind.Parameter); 38context.RegisterSyntaxNodeAction(AnalyzeLocal, SyntaxKind.LocalDeclarationStatement);
SingleVariableDeclarationAnalyzer.cs (2)
37context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.VariableDeclaration); 44if (vars.Count <= 1 || node.Parent.IsKind(SyntaxKind.ForStatement))
TypeParamNameAnalyzer.cs (1)
36context.RegisterSyntaxNodeAction(Analyze, SyntaxKind.TypeParameter);
QuarantineTools.Tests (10)
ActiveIssueTests.cs (5)
431SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(issueUrl))))); 440var indentation = SyntaxFactory.TriviaList(last.GetLeadingTrivia().Where(t => !t.IsKind(SyntaxKind.EndOfLineTrivia))); 441bool lastEndsWithNewline = last.GetTrailingTrivia().Any(t => t.IsKind(SyntaxKind.EndOfLineTrivia)); 474SyntaxFactory.Token(SyntaxKind.UsingKeyword) 477SyntaxFactory.Token(SyntaxKind.SemicolonToken)
QuarantineScriptTests.cs (5)
375SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal(issueUrl))))); 384var indentation = SyntaxFactory.TriviaList(last.GetLeadingTrivia().Where(t => !t.IsKind(SyntaxKind.EndOfLineTrivia))); 385bool lastEndsWithNewline = last.GetTrailingTrivia().Any(t => t.IsKind(SyntaxKind.EndOfLineTrivia)); 422SyntaxFactory.Token(SyntaxKind.UsingKeyword) 425SyntaxFactory.Token(SyntaxKind.SemicolonToken)
Roslyn.Diagnostics.CSharp.Analyzers (3047)
CSharpAvoidOptSuffixForNullableEnableCode.cs (3)
52}, SyntaxKind.Parameter); 58}, SyntaxKind.VariableDeclarator); 64}, SyntaxKind.PropertyDeclaration);
CSharpExposeMemberForTesting.cs (2)
40var refKeyword = SyntaxFactory.Token(SyntaxKind.RefKeyword); 44RefKind.RefReadOnly => SyntaxFactory.Token(SyntaxKind.ReadOnlyKeyword),
CSharpSpecializedEnumerableCreationAnalyzer.cs (11)
23context.RegisterCodeBlockStartAction<SyntaxKind>(new CodeBlockStartedAnalyzer(genericEnumerableSymbol, genericEmptyEnumerableSymbol).Initialize); 26private sealed class CodeBlockStartedAnalyzer : AbstractCodeBlockStartedAnalyzer<SyntaxKind> 33protected override void GetSyntaxAnalyzer(CodeBlockStartAnalysisContext<SyntaxKind> context, INamedTypeSymbol genericEnumerableSymbol, IMethodSymbol genericEmptyEnumerableSymbol) 35context.RegisterSyntaxNodeAction(new SyntaxAnalyzer(genericEnumerableSymbol, genericEmptyEnumerableSymbol).AnalyzeNode, SyntaxKind.ReturnStatement); 54case SyntaxKind.ArrayCreationExpression: 57case SyntaxKind.ImplicitArrayCreationExpression: 60case SyntaxKind.SimpleMemberAccessExpression: 71SyntaxKind.ArrayCreationExpression 72or SyntaxKind.ImplicitArrayCreationExpression => ShouldAnalyzeArrayCreationExpression(expression, semanticModel, cancellationToken), 73SyntaxKind.SimpleMemberAccessExpression => true, 86.FirstOrDefault(n => n.IsKind(SyntaxKind.NumericLiteralExpression)) is LiteralExpressionSyntax literalRankSpecifier)
CSharpSymbolDeclaredEventMustBeGeneratedForSourceSymbols.cs (3)
19public class CSharpSymbolDeclaredEventAnalyzer : SymbolDeclaredEventAnalyzer<SyntaxKind> 40protected override SyntaxKind InvocationExpressionSyntaxKind => SyntaxKind.InvocationExpression;
NumberCommentsRefactoring.cs (1)
41if (literal.Kind() == SyntaxKind.StringLiteralExpression &&
PreferNullLiteralCodeFixProvider.cs (3)
53ExpressionSyntax newSyntax = SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression); 57if (!type.IsKind(SyntaxKind.NullableType) && !type.IsKind(SyntaxKind.PointerType))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeGeneration\CSharpSyntaxTokens.cs (97)
11public static readonly SyntaxToken AbstractKeyword = Token(SyntaxKind.AbstractKeyword); 12public static readonly SyntaxToken AsKeyword = Token(SyntaxKind.AsKeyword); 13public static readonly SyntaxToken AssemblyKeyword = Token(SyntaxKind.AssemblyKeyword); 14public static readonly SyntaxToken AsyncKeyword = Token(SyntaxKind.AsyncKeyword); 15public static readonly SyntaxToken AwaitKeyword = Token(SyntaxKind.AwaitKeyword); 16public static readonly SyntaxToken BoolKeyword = Token(SyntaxKind.BoolKeyword); 17public static readonly SyntaxToken BreakKeyword = Token(SyntaxKind.BreakKeyword); 18public static readonly SyntaxToken ByteKeyword = Token(SyntaxKind.ByteKeyword); 19public static readonly SyntaxToken CaseKeyword = Token(SyntaxKind.CaseKeyword); 20public static readonly SyntaxToken CharKeyword = Token(SyntaxKind.CharKeyword); 21public static readonly SyntaxToken CheckedKeyword = Token(SyntaxKind.CheckedKeyword); 22public static readonly SyntaxToken CloseBraceToken = Token(SyntaxKind.CloseBraceToken); 23public static readonly SyntaxToken CloseBracketToken = Token(SyntaxKind.CloseBracketToken); 25public static readonly SyntaxToken ClosedKeyword = Token(SyntaxKind.ClosedKeyword); 27public static readonly SyntaxToken CloseParenToken = Token(SyntaxKind.CloseParenToken); 28public static readonly SyntaxToken ColonToken = Token(SyntaxKind.ColonToken); 29public static readonly SyntaxToken CommaToken = Token(SyntaxKind.CommaToken); 30public static readonly SyntaxToken ConstKeyword = Token(SyntaxKind.ConstKeyword); 31public static readonly SyntaxToken ContinueKeyword = Token(SyntaxKind.ContinueKeyword); 32public static readonly SyntaxToken DecimalKeyword = Token(SyntaxKind.DecimalKeyword); 33public static readonly SyntaxToken DisableKeyword = Token(SyntaxKind.DisableKeyword); 34public static readonly SyntaxToken DotDotToken = Token(SyntaxKind.DotDotToken); 35public static readonly SyntaxToken DoubleKeyword = Token(SyntaxKind.DoubleKeyword); 36public static readonly SyntaxToken EndOfDocumentationCommentToken = Token(SyntaxKind.EndOfDocumentationCommentToken); 37public static readonly SyntaxToken EqualsToken = Token(SyntaxKind.EqualsToken); 38public static readonly SyntaxToken ExplicitKeyword = Token(SyntaxKind.ExplicitKeyword); 40public static readonly SyntaxToken ExtensionKeyword = Token(SyntaxKind.ExtensionKeyword); 42public static readonly SyntaxToken ExternKeyword = Token(SyntaxKind.ExternKeyword); 43public static readonly SyntaxToken FileKeyword = Token(SyntaxKind.FileKeyword); 44public static readonly SyntaxToken FixedKeyword = Token(SyntaxKind.FixedKeyword); 45public static readonly SyntaxToken FloatKeyword = Token(SyntaxKind.FloatKeyword); 46public static readonly SyntaxToken ForEachKeyword = Token(SyntaxKind.ForEachKeyword); 47public static readonly SyntaxToken FromKeyword = Token(SyntaxKind.FromKeyword); 48public static readonly SyntaxToken GlobalKeyword = Token(SyntaxKind.GlobalKeyword); 49public static readonly SyntaxToken GreaterThanEqualsToken = Token(SyntaxKind.GreaterThanEqualsToken); 50public static readonly SyntaxToken GreaterThanToken = Token(SyntaxKind.GreaterThanToken); 51public static readonly SyntaxToken IfKeyword = Token(SyntaxKind.IfKeyword); 52public static readonly SyntaxToken ImplicitKeyword = Token(SyntaxKind.ImplicitKeyword); 53public static readonly SyntaxToken InKeyword = Token(SyntaxKind.InKeyword); 54public static readonly SyntaxToken InterfaceKeyword = Token(SyntaxKind.InterfaceKeyword); 55public static readonly SyntaxToken InternalKeyword = Token(SyntaxKind.InternalKeyword); 56public static readonly SyntaxToken InterpolatedStringEndToken = Token(SyntaxKind.InterpolatedStringEndToken); 57public static readonly SyntaxToken InterpolatedStringStartToken = Token(SyntaxKind.InterpolatedStringStartToken); 58public static readonly SyntaxToken IntKeyword = Token(SyntaxKind.IntKeyword); 59public static readonly SyntaxToken IsKeyword = Token(SyntaxKind.IsKeyword); 60public static readonly SyntaxToken LessThanEqualsToken = Token(SyntaxKind.LessThanEqualsToken); 61public static readonly SyntaxToken LessThanToken = Token(SyntaxKind.LessThanToken); 62public static readonly SyntaxToken LetKeyword = Token(SyntaxKind.LetKeyword); 63public static readonly SyntaxToken LongKeyword = Token(SyntaxKind.LongKeyword); 64public static readonly SyntaxToken MethodKeyword = Token(SyntaxKind.MethodKeyword); 65public static readonly SyntaxToken NewKeyword = Token(SyntaxKind.NewKeyword); 66public static readonly SyntaxToken NotKeyword = Token(SyntaxKind.NotKeyword); 67public static readonly SyntaxToken NullKeyword = Token(SyntaxKind.NullKeyword); 68public static readonly SyntaxToken ObjectKeyword = Token(SyntaxKind.ObjectKeyword); 69public static readonly SyntaxToken OpenBraceToken = Token(SyntaxKind.OpenBraceToken); 70public static readonly SyntaxToken OpenBracketToken = Token(SyntaxKind.OpenBracketToken); 71public static readonly SyntaxToken OpenParenToken = Token(SyntaxKind.OpenParenToken); 72public static readonly SyntaxToken OperatorKeyword = Token(SyntaxKind.OperatorKeyword); 73public static readonly SyntaxToken OutKeyword = Token(SyntaxKind.OutKeyword); 74public static readonly SyntaxToken OverrideKeyword = Token(SyntaxKind.OverrideKeyword); 75public static readonly SyntaxToken ParamsKeyword = Token(SyntaxKind.ParamsKeyword); 76public static readonly SyntaxToken PartialKeyword = Token(SyntaxKind.PartialKeyword); 77public static readonly SyntaxToken PlusToken = Token(SyntaxKind.PlusToken); 78public static readonly SyntaxToken PrivateKeyword = Token(SyntaxKind.PrivateKeyword); 79public static readonly SyntaxToken PropertyKeyword = Token(SyntaxKind.PropertyKeyword); 80public static readonly SyntaxToken ProtectedKeyword = Token(SyntaxKind.ProtectedKeyword); 81public static readonly SyntaxToken PublicKeyword = Token(SyntaxKind.PublicKeyword); 82public static readonly SyntaxToken QuestionQuestionEqualsToken = Token(SyntaxKind.QuestionQuestionEqualsToken); 83public static readonly SyntaxToken QuestionToken = Token(SyntaxKind.QuestionToken); 84public static readonly SyntaxToken ReadOnlyKeyword = Token(SyntaxKind.ReadOnlyKeyword); 85public static readonly SyntaxToken RecordKeyword = Token(SyntaxKind.RecordKeyword); 86public static readonly SyntaxToken RefKeyword = Token(SyntaxKind.RefKeyword); 87public static readonly SyntaxToken RequiredKeyword = Token(SyntaxKind.RequiredKeyword); 88public static readonly SyntaxToken RestoreKeyword = Token(SyntaxKind.RestoreKeyword); 89public static readonly SyntaxToken ReturnKeyword = Token(SyntaxKind.ReturnKeyword); 90public static readonly SyntaxToken SByteKeyword = Token(SyntaxKind.SByteKeyword); 91public static readonly SyntaxToken ScopedKeyword = Token(SyntaxKind.ScopedKeyword); 92public static readonly SyntaxToken SealedKeyword = Token(SyntaxKind.SealedKeyword); 93public static readonly SyntaxToken SemicolonToken = Token(SyntaxKind.SemicolonToken); 94public static readonly SyntaxToken ShortKeyword = Token(SyntaxKind.ShortKeyword); 95public static readonly SyntaxToken SlashGreaterThanToken = Token(SyntaxKind.SlashGreaterThanToken); 96public static readonly SyntaxToken StaticKeyword = Token(SyntaxKind.StaticKeyword); 97public static readonly SyntaxToken StringKeyword = Token(SyntaxKind.StringKeyword); 98public static readonly SyntaxToken StructKeyword = Token(SyntaxKind.StructKeyword); 99public static readonly SyntaxToken SwitchKeyword = Token(SyntaxKind.SwitchKeyword); 100public static readonly SyntaxToken ThisKeyword = Token(SyntaxKind.ThisKeyword); 101public static readonly SyntaxToken TildeToken = Token(SyntaxKind.TildeToken); 102public static readonly SyntaxToken UIntKeyword = Token(SyntaxKind.UIntKeyword); 103public static readonly SyntaxToken ULongKeyword = Token(SyntaxKind.ULongKeyword); 104public static readonly SyntaxToken UnmanagedKeyword = Token(SyntaxKind.UnmanagedKeyword); 105public static readonly SyntaxToken UnsafeKeyword = Token(SyntaxKind.UnsafeKeyword); 106public static readonly SyntaxToken UShortKeyword = Token(SyntaxKind.UShortKeyword); 107public static readonly SyntaxToken UsingKeyword = Token(SyntaxKind.UsingKeyword); 108public static readonly SyntaxToken VirtualKeyword = Token(SyntaxKind.VirtualKeyword); 109public static readonly SyntaxToken VoidKeyword = Token(SyntaxKind.VoidKeyword); 110public static readonly SyntaxToken VolatileKeyword = Token(SyntaxKind.VolatileKeyword); 111public static readonly SyntaxToken WhereKeyword = Token(SyntaxKind.WhereKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\CSharpCodeStyleOptions.cs (19)
157private static readonly ImmutableArray<SyntaxKind> s_preferredModifierOrderDefault = 159SyntaxKind.PublicKeyword, 160SyntaxKind.PrivateKeyword, 161SyntaxKind.ProtectedKeyword, 162SyntaxKind.InternalKeyword, 163SyntaxKind.FileKeyword, 164SyntaxKind.StaticKeyword, 165SyntaxKind.ExternKeyword, 166SyntaxKind.NewKeyword, 167SyntaxKind.VirtualKeyword, 168SyntaxKind.AbstractKeyword, 170SyntaxKind.ClosedKeyword, 172SyntaxKind.SealedKeyword, 173SyntaxKind.OverrideKeyword, 174SyntaxKind.ReadOnlyKeyword, 175SyntaxKind.UnsafeKeyword, 176SyntaxKind.RequiredKeyword, 177SyntaxKind.VolatileKeyword, 178SyntaxKind.AsyncKeyword,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\TypeStyle\TypeStyleHelper.cs (7)
66if (initializerExpression.IsKind(SyntaxKind.DefaultExpression)) 79if (initializerExpression.Kind() is SyntaxKind.ObjectCreationExpression or SyntaxKind.ArrayCreationExpression && 80!initializerExpression.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 87if (initializerExpression.Kind() is SyntaxKind.CastExpression or SyntaxKind.IsExpression or SyntaxKind.AsExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (18)
35if (token.Kind() is SyntaxKind.MultiLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken) 38if (token.Parent?.Parent is InterpolatedStringExpressionSyntax { StringStartToken.RawKind: (int)SyntaxKind.InterpolatedMultiLineRawStringStartToken }) 63case SyntaxKind.CharacterLiteralToken: 66case SyntaxKind.StringLiteralToken: 71case SyntaxKind.Utf8StringLiteralToken: 76case SyntaxKind.SingleLineRawStringLiteralToken: 77case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 80case SyntaxKind.MultiLineRawStringLiteralToken: 81case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 86case SyntaxKind.InterpolatedStringTextToken: 97SyntaxKind.InterpolatedStringStartToken => TryConvertStringToVirtualChars(token, "", "", escapeBraces: true), 98SyntaxKind.InterpolatedVerbatimStringStartToken => TryConvertVerbatimStringToVirtualChars(token, "", "", escapeBraces: true), 99SyntaxKind.InterpolatedSingleLineRawStringStartToken => TryConvertSingleLineRawStringToVirtualChars(token), 100SyntaxKind.InterpolatedMultiLineRawStringStartToken 138if (token.Kind() is SyntaxKind.Utf8SingleLineRawStringLiteralToken) 144if (token.Kind() is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ArgumentSyntaxExtensions.cs (5)
27SyntaxKind.RefKeyword => RefKind.Ref, 28SyntaxKind.OutKeyword => RefKind.Out, 29SyntaxKind.InKeyword => RefKind.In, 81if (argument.RefOrOutKeyword.Kind() == SyntaxKind.OutKeyword && 87if (argument.RefOrOutKeyword.Kind() == SyntaxKind.RefKeyword &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\AssignmentExpressionSyntaxExtensions.cs (4)
16return assignment.Kind() == SyntaxKind.SimpleAssignmentExpression && 17assignment.OperatorToken.Kind() == SyntaxKind.EqualsToken && 18(left.Kind() == SyntaxKind.TupleExpression || left.Kind() == SyntaxKind.DeclarationExpression);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (15)
27Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.IfDirectiveTrivia), nameof(IfDirectiveTriviaSyntax)), 29Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElifDirectiveTrivia), nameof(ElifDirectiveTriviaSyntax))), 30Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.ElseDirectiveTrivia), nameof(ElseDirectiveTriviaSyntax)), 31Matcher<DirectiveTriviaSyntax>.Single(d => d.IsKind(SyntaxKind.EndIfDirectiveTrivia), nameof(EndIfDirectiveTriviaSyntax))); 78if (leadingDirectives.Any(t => t.Kind() == SyntaxKind.EndIfDirectiveTrivia)) 113if (nextTrivia.Kind() == SyntaxKind.DisabledTextTrivia) 137SyntaxKind declarationKind, 157if (parent.Kind() == SyntaxKind.GetAccessorDeclaration) 175private static bool IsSupportedInCSharp6(SyntaxKind declarationKind) 179case SyntaxKind.ConstructorDeclaration: 180case SyntaxKind.DestructorDeclaration: 181case SyntaxKind.AddAccessorDeclaration: 182case SyntaxKind.RemoveAccessorDeclaration: 183case SyntaxKind.GetAccessorDeclaration: 184case SyntaxKind.SetAccessorDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DefaultExpressionSyntaxExtensions.cs (2)
16SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression); 69if (equalsValueClause.IsParentKind(SyntaxKind.VariableDeclarator) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\DirectiveSyntaxExtensions.cs (6)
63=> directive?.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia; 67is SyntaxKind.IfDirectiveTrivia 68or SyntaxKind.ElifDirectiveTrivia 69or SyntaxKind.ElseDirectiveTrivia 70or SyntaxKind.EndIfDirectiveTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ExpressionSyntaxExtensions.cs (138)
38while (expression is PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression) postfixExpression) 48=> expression?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == expression; 84return firstToken.Kind() != SyntaxKind.None 85&& firstToken.GetPreviousToken().Kind() == SyntaxKind.CloseParenToken; 98=> (expression?.Parent) is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && 109=> name.IsParentKind(SyntaxKind.ExplicitInterfaceSpecifier); 130if (expression is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess) 160if (!simpleName.IsKind(SyntaxKind.IdentifierName)) 187if (expression.IsParentKind(SyntaxKind.ConstantPattern)) 197=> expression?.Parent is ArgumentSyntax { RefOrOutKeyword: SyntaxToken(SyntaxKind.OutKeyword) } argument && 209while (expression?.Parent is ParenthesizedExpressionSyntax or PostfixUnaryExpressionSyntax(SyntaxKind.SuppressNullableWarningExpression)) 213ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.RefKeyword }) 224=> expression?.Parent is ArgumentSyntax { RefKindKeyword: SyntaxToken(SyntaxKind.InKeyword) }; 275if (!expr.IsParentKind(SyntaxKind.Argument)) 290case SyntaxKind.Argument: 291if (parent.Parent?.Kind() == SyntaxKind.TupleExpression) 298case SyntaxKind.SimpleAssignmentExpression: 305case SyntaxKind.ForEachVariableStatement: 355if (expression.Parent.IsKind(SyntaxKind.AddressOfExpression)) 400return nameEquals.IsParentKind(SyntaxKind.AttributeArgument); 409case SyntaxKind.PostIncrementExpression: 410case SyntaxKind.PreIncrementExpression: 411case SyntaxKind.PostDecrementExpression: 412case SyntaxKind.PreDecrementExpression: 428name.Identifier.Text == SyntaxFacts.GetText(SyntaxKind.NameOfKeyword)) 467if (expression.IsKind(SyntaxKind.StackAllocArrayCreationExpression)) 476is SyntaxKind.BaseExpression 477or SyntaxKind.CollectionInitializerExpression 478or SyntaxKind.ObjectInitializerExpression 479or SyntaxKind.ComplexElementInitializerExpression) 485if (expression is LiteralExpressionSyntax && !expression.IsParentKind(SyntaxKind.UnaryMinusExpression)) 515if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 517return expression is { Parent.RawKind: not (int)SyntaxKind.ConditionalAccessExpression }; 525case SyntaxKind.InvocationExpression: 529if (expression.IsKind(SyntaxKind.IdentifierName) || expression is MemberAccessExpressionSyntax) 552case SyntaxKind.ConditionalAccessExpression: 555!parentConditionalAccessExpression.Parent.IsKind(SyntaxKind.ConditionalAccessExpression); 557case SyntaxKind.IsExpression: 558case SyntaxKind.AsExpression: 562case SyntaxKind.EqualsValueClause: 563case SyntaxKind.ExpressionStatement: 564case SyntaxKind.ArrayInitializerExpression: 565case SyntaxKind.CollectionInitializerExpression: 566case SyntaxKind.Argument: 567case SyntaxKind.AttributeArgument: 568case SyntaxKind.AnonymousObjectMemberDeclarator: 569case SyntaxKind.ArrowExpressionClause: 570case SyntaxKind.AwaitExpression: 571case SyntaxKind.ReturnStatement: 572case SyntaxKind.YieldReturnStatement: 573case SyntaxKind.ParenthesizedLambdaExpression: 574case SyntaxKind.SimpleLambdaExpression: 575case SyntaxKind.ParenthesizedExpression: 576case SyntaxKind.ArrayRankSpecifier: 577case SyntaxKind.ConditionalExpression: 578case SyntaxKind.IfStatement: 579case SyntaxKind.CatchFilterClause: 580case SyntaxKind.WhileStatement: 581case SyntaxKind.DoStatement: 582case SyntaxKind.ThrowStatement: 583case SyntaxKind.SwitchStatement: 584case SyntaxKind.InterpolatedStringExpression: 585case SyntaxKind.ComplexElementInitializerExpression: 586case SyntaxKind.Interpolation: 587case SyntaxKind.RefExpression: 588case SyntaxKind.LockStatement: 589case SyntaxKind.ElementAccessExpression: 590case SyntaxKind.SwitchExpressionArm: 591case SyntaxKind.WhenClause: 598if (!(expression is LiteralExpressionSyntax && expression.IsParentKind(SyntaxKind.UnaryMinusExpression))) 639if ((expression.IsParentKind(SyntaxKind.NameEquals) && expression.Parent.IsParentKind(SyntaxKind.AttributeArgument)) || 655identifierName.Identifier.IsKindOrHasMatchingText(SyntaxKind.NameOfKeyword); 697case SyntaxKind.SimpleMemberAccessExpression: 698case SyntaxKind.ConditionalAccessExpression: 699case SyntaxKind.InvocationExpression: 700case SyntaxKind.ElementAccessExpression: 701case SyntaxKind.PostIncrementExpression: 702case SyntaxKind.PostDecrementExpression: 703case SyntaxKind.ObjectCreationExpression: 704case SyntaxKind.ImplicitObjectCreationExpression: 705case SyntaxKind.TypeOfExpression: 706case SyntaxKind.DefaultExpression: 707case SyntaxKind.CheckedExpression: 708case SyntaxKind.UncheckedExpression: 709case SyntaxKind.AnonymousMethodExpression: 710case SyntaxKind.SuppressNullableWarningExpression: 712case SyntaxKind.SizeOfExpression: 713case SyntaxKind.PointerMemberAccessExpression: 719case SyntaxKind.UnaryPlusExpression: 720case SyntaxKind.UnaryMinusExpression: 721case SyntaxKind.LogicalNotExpression: 722case SyntaxKind.BitwiseNotExpression: 723case SyntaxKind.PreIncrementExpression: 724case SyntaxKind.PreDecrementExpression: 725case SyntaxKind.CastExpression: 726case SyntaxKind.AwaitExpression: 728case SyntaxKind.PointerIndirectionExpression: 729case SyntaxKind.AddressOfExpression: 736case SyntaxKind.RangeExpression: 742case SyntaxKind.MultiplyExpression: 743case SyntaxKind.DivideExpression: 744case SyntaxKind.ModuloExpression: 750case SyntaxKind.AddExpression: 751case SyntaxKind.SubtractExpression: 757case SyntaxKind.LeftShiftExpression: 758case SyntaxKind.RightShiftExpression: 764case SyntaxKind.LessThanExpression: 765case SyntaxKind.GreaterThanExpression: 766case SyntaxKind.LessThanOrEqualExpression: 767case SyntaxKind.GreaterThanOrEqualExpression: 768case SyntaxKind.IsExpression: 769case SyntaxKind.AsExpression: 770case SyntaxKind.IsPatternExpression: 776case SyntaxKind.EqualsExpression: 777case SyntaxKind.NotEqualsExpression: 783case SyntaxKind.BitwiseAndExpression: 789case SyntaxKind.ExclusiveOrExpression: 795case SyntaxKind.BitwiseOrExpression: 801case SyntaxKind.LogicalAndExpression: 807case SyntaxKind.LogicalOrExpression: 813case SyntaxKind.CoalesceExpression: 819case SyntaxKind.ConditionalExpression: 825case SyntaxKind.SimpleAssignmentExpression: 826case SyntaxKind.MultiplyAssignmentExpression: 827case SyntaxKind.DivideAssignmentExpression: 828case SyntaxKind.ModuloAssignmentExpression: 829case SyntaxKind.AddAssignmentExpression: 830case SyntaxKind.SubtractAssignmentExpression: 831case SyntaxKind.LeftShiftAssignmentExpression: 832case SyntaxKind.RightShiftAssignmentExpression: 833case SyntaxKind.AndAssignmentExpression: 834case SyntaxKind.ExclusiveOrAssignmentExpression: 835case SyntaxKind.OrAssignmentExpression: 836case SyntaxKind.SimpleLambdaExpression: 837case SyntaxKind.ParenthesizedLambdaExpression: 843case SyntaxKind.SwitchExpression: 1091return binaryExpression.Kind() == SyntaxKind.CoalesceExpression && binaryExpression.Right == expression && HasType(binaryExpression.Left, out var leftType) ? leftType : null;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ILocalSymbolExtensions.cs (2)
17.FirstOrDefault(node => node.Kind() is SyntaxKind.LocalFunctionStatement or SyntaxKind.MethodDeclaration);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.cs (50)
32case SyntaxKind.EnumDeclaration: 34case SyntaxKind.ClassDeclaration: 36case SyntaxKind.ExtensionBlockDeclaration: 37case SyntaxKind.UnionDeclaration: 39case SyntaxKind.InterfaceDeclaration: 40case SyntaxKind.RecordDeclaration: 41case SyntaxKind.RecordStructDeclaration: 42case SyntaxKind.StructDeclaration: 44case SyntaxKind.DelegateDeclaration: 46case SyntaxKind.FieldDeclaration: 48case SyntaxKind.EventFieldDeclaration: 50case SyntaxKind.PropertyDeclaration: 52case SyntaxKind.EventDeclaration: 54case SyntaxKind.MethodDeclaration: 56case SyntaxKind.ConstructorDeclaration: 58case SyntaxKind.DestructorDeclaration: 60case SyntaxKind.IndexerDeclaration: 62case SyntaxKind.OperatorDeclaration: 77case SyntaxKind.ClassDeclaration: 79case SyntaxKind.ExtensionBlockDeclaration: 80case SyntaxKind.UnionDeclaration: 82case SyntaxKind.InterfaceDeclaration: 83case SyntaxKind.RecordDeclaration: 84case SyntaxKind.RecordStructDeclaration: 85case SyntaxKind.StructDeclaration: 87case SyntaxKind.DelegateDeclaration: 89case SyntaxKind.MethodDeclaration: 105case SyntaxKind.ClassDeclaration: 107case SyntaxKind.ExtensionBlockDeclaration: 108case SyntaxKind.UnionDeclaration: 110case SyntaxKind.InterfaceDeclaration: 111case SyntaxKind.RecordDeclaration: 112case SyntaxKind.RecordStructDeclaration: 113case SyntaxKind.StructDeclaration: 115case SyntaxKind.DelegateDeclaration: 117case SyntaxKind.MethodDeclaration: 135case SyntaxKind.DelegateDeclaration: 137case SyntaxKind.MethodDeclaration: 139case SyntaxKind.ConstructorDeclaration: 141case SyntaxKind.IndexerDeclaration: 143case SyntaxKind.OperatorDeclaration: 145case SyntaxKind.ConversionOperatorDeclaration: 159case SyntaxKind.DelegateDeclaration: 161case SyntaxKind.MethodDeclaration: 163case SyntaxKind.OperatorDeclaration: 165case SyntaxKind.PropertyDeclaration: 167case SyntaxKind.IndexerDeclaration: 169case SyntaxKind.EventDeclaration: 171case SyntaxKind.EventFieldDeclaration: 173case SyntaxKind.FieldDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\MemberDeclarationSyntaxExtensions.DeclarationFinder.cs (1)
32if (syntaxToken.Kind() == SyntaxKind.IdentifierToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\ParenthesizedExpressionSyntaxExtensions.cs (75)
38var parentExpression = nodeParent.IsKind(SyntaxKind.ConstantPattern) 57if (expression.IsKind(SyntaxKind.ParenthesizedExpression) || 58parentExpression.IsKind(SyntaxKind.ParenthesizedExpression)) 84if (expression.Kind() is SyntaxKind.GreaterThanExpression or SyntaxKind.LessThanExpression && 87var opposite = expression.IsKind(SyntaxKind.GreaterThanExpression) ? SyntaxKind.LessThanExpression : SyntaxKind.GreaterThanExpression; 93if (expression.IsKind(SyntaxKind.ThrowExpression)) 97if (nodeParent.IsKind(SyntaxKind.ExpressionStatement)) 101if (nodeParent.IsKind(SyntaxKind.ArrowExpressionClause)) 105if (nodeParent.Kind() is SyntaxKind.CheckedExpression or SyntaxKind.UncheckedExpression) 109if (expression.IsKind(SyntaxKind.TupleExpression)) 117if (tokenAfterParen.Kind() == SyntaxKind.OpenBracketToken) 170(nodeParent is YieldStatementSyntax(SyntaxKind.YieldReturnStatement) yieldStatement && yieldStatement.Expression == node) || 195if (nodeParent.IsKind(SyntaxKind.CastExpression) && expression.IsKind(SyntaxKind.ThisExpression)) 205if (nodeParent.IsKind(SyntaxKind.Interpolation)) 210if (expression.IsKind(SyntaxKind.InterpolatedStringExpression)) 257if (expression.IsKind(SyntaxKind.ThisExpression)) 271if (expression.IsKind(SyntaxKind.ThrowExpression) && 272nodeParent is BinaryExpressionSyntax(SyntaxKind.CoalesceExpression) binary && 279if (nodeParent.IsKind(SyntaxKind.CaseSwitchLabel)) 283if (nodeParent.IsKind(SyntaxKind.ConstantPattern) && 284nodeParent.IsParentKind(SyntaxKind.CasePatternSwitchLabel)) 290if (nodeParent.IsKind(SyntaxKind.WhenClause)) 318if (parentExpression.IsKind(SyntaxKind.CastExpression) && 319expression.Kind() is SyntaxKind.PreIncrementExpression or SyntaxKind.PreDecrementExpression) 326if (expression.IsKind(SyntaxKind.ConditionalExpression) && 337if (expression.IsKind(SyntaxKind.ConditionalAccessExpression)) 389if (ancestor.IsKind(SyntaxKind.ParenthesizedExpression)) 392if (ancestor.IsKind(SyntaxKind.Interpolation, out interpolation)) 414if (!childNode.IsKind(SyntaxKind.ParenthesizedExpression)) 419if (nodeOrToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.ColonColonToken) 488if (parentExpression.IsKind(SyntaxKind.CoalesceExpression)) 510private static bool IsAssociative(SyntaxKind kind) 514case SyntaxKind.AddExpression: 515case SyntaxKind.MultiplyExpression: 516case SyntaxKind.BitwiseOrExpression: 517case SyntaxKind.ExclusiveOrExpression: 518case SyntaxKind.LogicalOrExpression: 519case SyntaxKind.BitwiseAndExpression: 520case SyntaxKind.LogicalAndExpression: 551SyntaxKind.PredefinedType or 552SyntaxKind.ArrayType or 553SyntaxKind.PointerType or 554SyntaxKind.NullableType) 567SyntaxKind.UnaryMinusExpression or 568SyntaxKind.UnaryPlusExpression or 569SyntaxKind.PointerIndirectionExpression or 570SyntaxKind.AddressOfExpression) 581if (name.IsKind(SyntaxKind.AliasQualifiedName)) 607binaryExpression.Kind() is SyntaxKind.LessThanExpression or SyntaxKind.GreaterThanExpression && 608(binaryExpression.IsParentKind(SyntaxKind.Argument) || binaryExpression.Parent is InitializerExpressionSyntax)) 610if (binaryExpression.IsKind(SyntaxKind.LessThanExpression)) 623else if (binaryExpression.IsKind(SyntaxKind.GreaterThanExpression)) 626binaryExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression) 638else if (node.Expression.IsKind(SyntaxKind.LessThanExpression)) 645else if (node.Expression.IsKind(SyntaxKind.GreaterThanExpression)) 681previousExpression is not BinaryExpressionSyntax(SyntaxKind.LessThanExpression) lessThanExpression) 687|| lessThanExpression.Left.IsKind(SyntaxKind.CastExpression)) 716nextExpression is not BinaryExpressionSyntax(SyntaxKind.GreaterThanExpression) greaterThanExpression) 722&& greaterThanExpression.Right.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.CastExpression; 726=> expression.Kind() is SyntaxKind.IdentifierName or SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression; 818if (binaryPattern.IsKind(SyntaxKind.AndPattern)) 821if (binaryPattern.IsKind(SyntaxKind.OrPattern))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (31)
63case SyntaxKind.SimpleMemberAccessExpression: 64case SyntaxKind.PointerMemberAccessExpression: 70case SyntaxKind.QualifiedName: 76case SyntaxKind.AliasQualifiedName: 82case SyntaxKind.GenericName: 88case SyntaxKind.IdentifierName: 153case SyntaxKind.CommaToken: 154case SyntaxKind.DelegateKeyword: 225variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 232if (type.IsParentKind(SyntaxKind.ObjectCreationExpression) && 233type.Parent.IsParentKind(SyntaxKind.EqualsValueClause) && 234type.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclarator) && 235type.Parent.Parent.Parent.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 236variableDeclaration.IsParentKind(SyntaxKind.FieldDeclaration)) 252is SyntaxKind.DelegateDeclaration 253or SyntaxKind.MethodDeclaration 254or SyntaxKind.PropertyDeclaration 255or SyntaxKind.EventDeclaration 256or SyntaxKind.IndexerDeclaration 257or SyntaxKind.OperatorDeclaration) 273if (type.IsParentKind(SyntaxKind.Parameter) && type.Parent.IsParentKind(SyntaxKind.ParameterList)) 276is SyntaxKind.DelegateDeclaration 277or SyntaxKind.MethodDeclaration 278or SyntaxKind.IndexerDeclaration 279or SyntaxKind.OperatorDeclaration) 285if (type.Parent.Parent.IsParentKind(SyntaxKind.ConstructorDeclaration)) 296if (type.IsParentKind(SyntaxKind.VariableDeclaration, out variableDeclaration) && 297variableDeclaration.IsParentKind(SyntaxKind.EventFieldDeclaration)) 307if (type.IsParentKind(SyntaxKind.TypeConstraint)) 447if (SyntaxFacts.GetContextualKeywordKind(parameter.Name) is not SyntaxKind.UnderscoreToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SimpleNameSyntaxExtensions.cs (1)
16Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.IsParentKind(SyntaxKind.NameMemberCref));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\StatementSyntaxExtensions.cs (2)
40if (first.Parent.IsKind(SyntaxKind.GlobalStatement)) 41return second.Parent.IsKind(SyntaxKind.GlobalStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SymbolDisplayPartExtensions.cs (1)
21if (SyntaxFacts.GetKeywordKind(text) != SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxKindExtensions.cs (29)
14/// Determine if the given <see cref="SyntaxKind"/> array contains the given kind. 22public static bool Contains(this SyntaxKind[] kinds, SyntaxKind kind) 24foreach (var k in kinds) 35public static SyntaxKind MapCompoundAssignmentKindToBinaryExpressionKind(this SyntaxKind syntaxKind) 39case SyntaxKind.AddAssignmentExpression: 40return SyntaxKind.AddExpression; 42case SyntaxKind.SubtractAssignmentExpression: 43return SyntaxKind.SubtractExpression; 45case SyntaxKind.MultiplyAssignmentExpression: 46return SyntaxKind.MultiplyExpression; 48case SyntaxKind.DivideAssignmentExpression: 49return SyntaxKind.DivideExpression; 51case SyntaxKind.ModuloAssignmentExpression: 52return SyntaxKind.ModuloExpression; 54case SyntaxKind.AndAssignmentExpression: 55return SyntaxKind.BitwiseAndExpression; 57case SyntaxKind.ExclusiveOrAssignmentExpression: 58return SyntaxKind.ExclusiveOrExpression; 60case SyntaxKind.OrAssignmentExpression: 61return SyntaxKind.BitwiseOrExpression; 63case SyntaxKind.LeftShiftAssignmentExpression: 64return SyntaxKind.LeftShiftExpression; 66case SyntaxKind.RightShiftAssignmentExpression: 67return SyntaxKind.RightShiftExpression; 69case SyntaxKind.CoalesceAssignmentExpression: 70return SyntaxKind.CoalesceExpression; 74return SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (57)
28public static void Deconstruct(this SyntaxNode node, out SyntaxKind kind) 31public static bool IsKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 44public static bool IsParentKind([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind) 47public static bool IsParentKind<TNode>([NotNullWhen(true)] this SyntaxNode? node, SyntaxKind kind, [NotNullWhen(true)] out TNode? result) 75if (prevToken.Kind() == SyntaxKind.None) 93is SyntaxKind.ArgumentList 94or SyntaxKind.AttributeArgumentList 95or SyntaxKind.BracketedArgumentList 96or SyntaxKind.TypeArgumentList; 186if ((current?.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAccessExpression) memberAccess && memberAccess.Name == current) || 196SyntaxKind.InvocationExpression or 197SyntaxKind.ElementAccessExpression or 198SyntaxKind.SimpleMemberAccessExpression or 199SyntaxKind.MemberBindingExpression or 200SyntaxKind.ElementBindingExpression or 202SyntaxKind.SuppressNullableWarningExpression) && 285=> node is AssignmentExpressionSyntax(kind: not SyntaxKind.SimpleAssignmentExpression); 288=> node?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment && 332m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword)); 345case LocalFunctionStatementSyntax localFunction when localFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 348case AnonymousFunctionExpressionSyntax anonymousFunction when anonymousFunction.Modifiers.Any(SyntaxKind.StaticKeyword): 352return current.GetModifiers().Any(SyntaxKind.StaticKeyword); 355return property.Modifiers.Any(SyntaxKind.StaticKeyword) || 360return !current.Parent.IsKind(SyntaxKind.CompilationUnit); 399case SyntaxKind.DoStatement: 400case SyntaxKind.WhileStatement: 401case SyntaxKind.SwitchStatement: 402case SyntaxKind.ForStatement: 403case SyntaxKind.ForEachStatement: 404case SyntaxKind.ForEachVariableStatement: 415case SyntaxKind.DoStatement: 416case SyntaxKind.WhileStatement: 417case SyntaxKind.ForStatement: 418case SyntaxKind.ForEachStatement: 419case SyntaxKind.ForEachVariableStatement: 430case SyntaxKind.AnonymousMethodExpression: 431case SyntaxKind.SimpleLambdaExpression: 432case SyntaxKind.ParenthesizedLambdaExpression: 433case SyntaxKind.LocalFunctionStatement: 434case SyntaxKind.MethodDeclaration: 435case SyntaxKind.ConstructorDeclaration: 436case SyntaxKind.DestructorDeclaration: 437case SyntaxKind.GetAccessorDeclaration: 438case SyntaxKind.SetAccessorDeclaration: 439case SyntaxKind.InitAccessorDeclaration: 440case SyntaxKind.OperatorDeclaration: 441case SyntaxKind.ConversionOperatorDeclaration: 442case SyntaxKind.AddAccessorDeclaration: 443case SyntaxKind.RemoveAccessorDeclaration: 454=> node.IsReturnableConstruct() || (node is CompilationUnitSyntax compilationUnit && compilationUnit.Members.Any(SyntaxKind.GlobalStatement)); 556if (trivia.GetStructure() is (kind: SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia or SyntaxKind.IfDirectiveTrivia or SyntaxKind.EndIfDirectiveTrivia)) 570else if (trivia.GetStructure() is (kind: SyntaxKind.ElseDirectiveTrivia or SyntaxKind.ElifDirectiveTrivia)) 898while (finalTrivia is [.., (kind: SyntaxKind.WhitespaceTrivia)])
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.SingleLineRewriter.cs (2)
60if (token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (88)
20public static void Deconstruct(this SyntaxToken token, out SyntaxKind kind) 39public static bool IsKindOrHasMatchingText(this SyntaxToken token, SyntaxKind kind) 42public static bool HasMatchingText(this SyntaxToken token, SyntaxKind kind) 46=> token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 47token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression); 50=> token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent.IsKind(SyntaxKind.AccessorList); 64if (token.Kind() == SyntaxKind.IdentifierToken) 69SyntaxFacts.GetContextualKeywordKind(simpleNameText) != SyntaxKind.None; 75public static bool IsPotentialModifier(this SyntaxToken token, out SyntaxKind modifierKind) 77var tokenKind = token.Kind(); 78modifierKind = SyntaxKind.None; 82case SyntaxKind.PublicKeyword: 83case SyntaxKind.InternalKeyword: 84case SyntaxKind.ProtectedKeyword: 85case SyntaxKind.PrivateKeyword: 86case SyntaxKind.SealedKeyword: 87case SyntaxKind.AbstractKeyword: 89case SyntaxKind.ClosedKeyword: 91case SyntaxKind.StaticKeyword: 92case SyntaxKind.VirtualKeyword: 93case SyntaxKind.ExternKeyword: 94case SyntaxKind.NewKeyword: 95case SyntaxKind.OverrideKeyword: 96case SyntaxKind.ReadOnlyKeyword: 97case SyntaxKind.VolatileKeyword: 98case SyntaxKind.UnsafeKeyword: 99case SyntaxKind.AsyncKeyword: 100case SyntaxKind.RefKeyword: 101case SyntaxKind.OutKeyword: 102case SyntaxKind.InKeyword: 103case SyntaxKind.RequiredKeyword: 104case SyntaxKind.FileKeyword: 105case SyntaxKind.PartialKeyword: 108case SyntaxKind.IdentifierToken: 109if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 111modifierKind = SyntaxKind.AsyncKeyword; 113if (token.HasMatchingText(SyntaxKind.FileKeyword)) 115modifierKind = SyntaxKind.FileKeyword; 118if (token.HasMatchingText(SyntaxKind.ClosedKeyword)) 120modifierKind = SyntaxKind.ClosedKeyword; 123if (token.HasMatchingText(SyntaxKind.PartialKeyword)) 125modifierKind = SyntaxKind.PartialKeyword; 127return modifierKind != SyntaxKind.None; 137case SyntaxKind.CharacterLiteralToken: 138case SyntaxKind.FalseKeyword: 139case SyntaxKind.NumericLiteralToken: 140case SyntaxKind.StringLiteralToken: 141case SyntaxKind.TrueKeyword: 171if (previousToken.Kind() == SyntaxKind.None) 204=> token.Kind() == SyntaxKind.StringLiteralToken && !token.IsVerbatimStringLiteral(); 210case SyntaxKind.AssemblyKeyword: 211case SyntaxKind.ModuleKeyword: 212case SyntaxKind.FieldKeyword: 213case SyntaxKind.EventKeyword: 214case SyntaxKind.MethodKeyword: 215case SyntaxKind.ParamKeyword: 216case SyntaxKind.PropertyKeyword: 217case SyntaxKind.ReturnKeyword: 218case SyntaxKind.TypeKeyword: 242if (genericIdentifier.GetNextToken(includeSkipped: true).Kind() == SyntaxKind.LessThanToken) 266Contract.ThrowIfFalse(genericIdentifier.Kind() == SyntaxKind.IdentifierToken); 270Contract.ThrowIfFalse(token.Kind() == SyntaxKind.LessThanToken); 279if (next.Kind() == SyntaxKind.None) 287if (token.Kind() == SyntaxKind.GreaterThanToken) 302case SyntaxKind.LessThanLessThanToken: 304goto case SyntaxKind.LessThanToken; 307case SyntaxKind.LessThanToken: 311case SyntaxKind.AsteriskToken: // for int* 312case SyntaxKind.QuestionToken: // for int? 313case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 314case SyntaxKind.ColonColonToken: // for global:: 315case SyntaxKind.CloseBracketToken: 316case SyntaxKind.OpenBracketToken: 317case SyntaxKind.DotToken: 318case SyntaxKind.IdentifierToken: 319case SyntaxKind.CommaToken: 323case SyntaxKind.ClassKeyword: 324case SyntaxKind.StructKeyword: 325case SyntaxKind.InterfaceKeyword: 326case SyntaxKind.DelegateKeyword: 327case SyntaxKind.EnumKeyword: 328case SyntaxKind.PrivateKeyword: 329case SyntaxKind.PublicKeyword: 330case SyntaxKind.InternalKeyword: 331case SyntaxKind.ProtectedKeyword: 332case SyntaxKind.VoidKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (54)
17public static ISet<SyntaxKind> GetPrecedingModifiers(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) 20public static ISet<SyntaxKind> GetPrecedingModifiers( 30var result = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer); 31while (token.IsPotentialModifier(out var modifierKind)) 87private static readonly Func<SyntaxKind, bool> s_isDot = k => k is SyntaxKind.DotToken; 88private static readonly Func<SyntaxKind, bool> s_isDotOrArrow = k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken; 89private static readonly Func<SyntaxKind, bool> s_isDotOrArrowOrColonColon = 90k => k is SyntaxKind.DotToken or SyntaxKind.MinusGreaterThanToken or SyntaxKind.ColonColonToken; 95(targetToken.IsKind(SyntaxKind.DotDotToken) && position == targetToken.SpanStart + 1) || 106this SyntaxTree syntaxTree, int position, Func<SyntaxKind, bool> predicate, CancellationToken cancellationToken) 111if (token.Kind() == SyntaxKind.None) 122return token.Kind() == SyntaxKind.NumericLiteralToken; 125public static bool IsAfterKeyword(this SyntaxTree syntaxTree, int position, SyntaxKind kind, CancellationToken cancellationToken) 202var endsWithNewLine = trivia.GetStructure()!.GetLastToken(includeSkipped: true).Kind() == SyntaxKind.XmlTextLiteralNewLineToken; 263if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 269return trivia.Kind() == SyntaxKind.ConflictMarkerTrivia; 277if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 303if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 324var kind = token.Kind(); 326SyntaxKind.StringLiteralToken or 327SyntaxKind.CharacterLiteralToken or 328SyntaxKind.SingleLineRawStringLiteralToken or 329SyntaxKind.MultiLineRawStringLiteralToken or 330SyntaxKind.Utf8StringLiteralToken or 331SyntaxKind.Utf8SingleLineRawStringLiteralToken or 332SyntaxKind.Utf8MultiLineRawStringLiteralToken)) 339SyntaxKind.Utf8StringLiteralToken or 340SyntaxKind.Utf8SingleLineRawStringLiteralToken or 341SyntaxKind.Utf8MultiLineRawStringLiteralToken) 349if (kind is SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken) 399if (token.Kind() is SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken) 404SyntaxKind.StringLiteralToken or 405SyntaxKind.SingleLineRawStringLiteralToken or 406SyntaxKind.MultiLineRawStringLiteralToken or 407SyntaxKind.Utf8StringLiteralToken or 408SyntaxKind.Utf8SingleLineRawStringLiteralToken or 409SyntaxKind.Utf8MultiLineRawStringLiteralToken) 421SyntaxKind.InterpolatedStringStartToken or 422SyntaxKind.InterpolatedStringEndToken or 423SyntaxKind.InterpolatedRawStringEndToken or 424SyntaxKind.InterpolatedSingleLineRawStringStartToken or 425SyntaxKind.InterpolatedMultiLineRawStringStartToken) 430if (token.Kind() is SyntaxKind.InterpolatedStringTextToken) 455if (token.Kind() == SyntaxKind.CharacterLiteralToken) 497if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 503if (token.Kind() == SyntaxKind.EndOfFileToken) 553if (token.IsKind(SyntaxKind.HashToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (15)
21public static void Deconstruct(this SyntaxTrivia trivia, out SyntaxKind kind) 25=> trivia.Kind() is SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineCommentTrivia; 37=> trivia.Kind() == SyntaxKind.SingleLineCommentTrivia; 40=> trivia.Kind() == SyntaxKind.MultiLineCommentTrivia; 43=> trivia.Kind() == SyntaxKind.ShebangDirectiveTrivia; 47if (trivia.Kind() != SyntaxKind.MultiLineCommentTrivia) 58=> trivia.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia; 61=> trivia.Kind() == SyntaxKind.MultiLineDocumentationCommentTrivia; 66if (trivia.Kind() == SyntaxKind.SingleLineCommentTrivia) 75else if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 148=> trivia.Kind() == SyntaxKind.EndOfLineTrivia; 151=> trivia.Kind() == SyntaxKind.WhitespaceTrivia; 203if (trivia.IsKind(SyntaxKind.PragmaWarningDirectiveTrivia)) 206isDisable = pragmaWarning.DisableOrRestoreKeyword.IsKind(SyntaxKind.DisableKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaListExtensions.cs (8)
21.Where(t => t.Kind() == SyntaxKind.EndOfLineTrivia) 38.Where(t => t is (kind: SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.WhitespaceTrivia)) 43=> triviaList.SkipWhile(t => t.Kind() == SyntaxKind.WhitespaceTrivia); 52if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 55t.Kind() is SyntaxKind.EndOfLineTrivia or 56SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\TypeSyntaxExtensions.cs (2)
15predefinedType.Keyword.IsKind(SyntaxKind.VoidKeyword); 20((IdentifierNameSyntax)typeSyntax).Identifier.IsKind(SyntaxKind.PartialKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\DefaultOperationProvider.cs (1)
45var space = currentToken.Kind() == SyntaxKind.EndOfFileToken ? 0 : 1;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (16)
37=> trivia.RawKind == (int)SyntaxKind.WhitespaceTrivia; 40=> trivia.RawKind == (int)SyntaxKind.EndOfLineTrivia; 69if (trivia2.IsKind(SyntaxKind.None)) 90if (trivia2.IsKind(SyntaxKind.BadDirectiveTrivia) && existingWhitespaceBetween.Lines == 0 && !implicitLineBreak) 97var lines = (trivia1.IsKind(SyntaxKind.None) && this.Token1.IsKind(SyntaxKind.None)) ? 0 : 1; 99if (trivia2.Kind() is SyntaxKind.RegionDirectiveTrivia or SyntaxKind.EndRegionDirectiveTrivia) 110if (previous.IsKind(SyntaxKind.DisabledTextTrivia)) 114else if (previous.IsKind(SyntaxKind.EndIfDirectiveTrivia)) 178if (trivia2.IsKind(SyntaxKind.SkippedTokensTrivia)) 198structuredTrivia.GetTrailingTrivia().Any(SyntaxKind.EndOfLineTrivia); 210var isAtEndOfFileToken = (Token2.IsKind(SyntaxKind.EndOfFileToken) && trivia2.Kind() == 0); 220if (trivia.Kind() == SyntaxKind.MultiLineCommentTrivia) 334if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 363if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.DocumentationCommentExteriorCommentRewriter.cs (3)
34if (trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia) 71if (currentParent.Kind() is SyntaxKind.SingleLineDocumentationCommentTrivia or 72SyntaxKind.MultiLineDocumentationCommentTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (9)
66for (var currentToken = token1; !currentToken.IsKind(SyntaxKind.None);) 76if (previousToken.TrailingTrivia is [.., (kind: SyntaxKind.EndOfLineTrivia)]) 101if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 105else if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) 113else if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia) 117else if (trivia.Kind() is SyntaxKind.DisabledTextTrivia or 118SyntaxKind.PreprocessingMessageTrivia) 122else if (trivia.Kind() == SyntaxKind.ConflictMarkerTrivia) 155Debug.Assert(trivia.Kind() == SyntaxKind.WhitespaceTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (18)
36Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.EndOfLineTrivia); 37Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.SkippedTokensTrivia); 38Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia); 46if (trivia.Kind() == SyntaxKind.WhitespaceTrivia) 63if (trivia.Kind() == SyntaxKind.RegionDirectiveTrivia || 64trivia.Kind() == SyntaxKind.EndRegionDirectiveTrivia || 78if (trivia.Kind() is SyntaxKind.SkippedTokensTrivia or 79SyntaxKind.PreprocessingMessageTrivia) 125if (trivia.Kind() != SyntaxKind.WhitespaceTrivia) 154if (trivia.Kind() != SyntaxKind.EndOfLineTrivia) 213if (trivia.Kind() is not SyntaxKind.SkippedTokensTrivia and 214not SyntaxKind.PreprocessingMessageTrivia) 224if (trivia.Kind() is not SyntaxKind.RegionDirectiveTrivia and 225not SyntaxKind.EndRegionDirectiveTrivia) 269trivia.Kind() == SyntaxKind.WhitespaceTrivia || 270trivia.Kind() == SyntaxKind.EndOfLineTrivia) 309if (trivia.IsKind(SyntaxKind.DisabledTextTrivia)) 332if (xmlTrivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (2)
53var formatSpanEnd = commonToken2.Kind() == SyntaxKind.None ? commonToken1.Span.End : commonToken2.Span.Start; 81var firstTriviaInTree = this.Token1.Kind() == SyntaxKind.None;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (1)
119if (trivia.Kind() == SyntaxKind.EndOfLineTrivia)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (95)
57if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.None) || 59bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.None)) 64if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBraceToken)) 66return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBraceToken); 69if (bracketOrBracePair.openBracketOrBrace.IsKind(SyntaxKind.OpenBracketToken)) 71return bracketOrBracePair.closeBracketOrBrace.IsKind(SyntaxKind.CloseBracketToken); 78=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.ConversionOperatorDeclaration); 81=> token.IsOpenParenInParameterList() && token.Parent.IsParentKind(SyntaxKind.OperatorDeclaration); 84=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 87=> token.Kind() == SyntaxKind.CloseParenToken && token.Parent.IsKind(SyntaxKind.ParameterList); 91return token.Kind() == SyntaxKind.OpenParenToken && 97return token.Kind() == SyntaxKind.CloseParenToken && 104if (token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList)) 110if (token.Parent.IsKind(SyntaxKind.PositionalPatternClause) && token.Parent.Parent.IsKind(SyntaxKind.RecursivePattern)) 120=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.BaseList); 123=> token.Kind() == SyntaxKind.CommaToken && (token.Parent.IsAnyArgumentList() || token.Parent?.Kind() is SyntaxKind.ParameterList or SyntaxKind.FunctionPointerParameterList); 126=> token.Kind() == SyntaxKind.OpenParenToken && token.Parent.IsKind(SyntaxKind.ParameterList) && token.Parent.Parent.IsKind(SyntaxKind.ParenthesizedLambdaExpression); 130if (node.Kind() != SyntaxKind.Block) 135return node.Parent?.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression; 140if (node.Kind() != SyntaxKind.Block) 145return node.IsParentKind(SyntaxKind.AnonymousMethodExpression); 151token.Kind() == SyntaxKind.SemicolonToken && 158if (token.Kind() != SyntaxKind.SemicolonToken) 174if (token.Kind() != SyntaxKind.CloseBraceToken) 179return token.Parent is ExpressionSyntax || token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 184if (token.Kind() != SyntaxKind.CloseBraceToken) 210return token.Kind() == SyntaxKind.CommaToken && 211token.Parent.IsKind(SyntaxKind.EnumDeclaration); 216return token.Kind() == SyntaxKind.CommaToken && 222return token.Kind() == SyntaxKind.CommaToken && 223token.Parent.IsKind(SyntaxKind.VariableDeclaration); 237case SyntaxKind.SizeOfExpression: 241case SyntaxKind.TypeOfExpression: 245case SyntaxKind.CheckedExpression: 246case SyntaxKind.UncheckedExpression: 250case SyntaxKind.DefaultExpression: 254case SyntaxKind.MakeRefExpression: 258case SyntaxKind.RefTypeExpression: 262case SyntaxKind.RefValueExpression: 266case SyntaxKind.ArgumentList: 270case SyntaxKind.AttributeArgumentList: 280return token.IsKind(SyntaxKind.EqualsToken) && 281token.Parent.IsKind(SyntaxKind.EqualsValueClause) && 282token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration); 308=> token.IsDotInMemberAccess() || (token.Kind() == SyntaxKind.DotToken && token.Parent.IsKind(SyntaxKind.QualifiedName)); 317return token.Kind() == SyntaxKind.DotToken 323if (token.Kind() == SyntaxKind.GreaterThanToken) 324return token.Parent is (kind: SyntaxKind.TypeParameterList or SyntaxKind.TypeArgumentList); 331return token.Kind() == SyntaxKind.CommaToken && 337=> token.Kind() == SyntaxKind.ColonToken && token.Parent is CasePatternSwitchLabelSyntax; 340=> token.Kind() == SyntaxKind.ColonToken && token.Parent.IsKind(SyntaxKind.SwitchExpressionArm); 343=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.SwitchExpression); 346=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.PropertyPatternClause); 350return token.Kind() == SyntaxKind.IdentifierToken && 360return token.Kind() == SyntaxKind.ColonToken && 377=> token.Kind() == SyntaxKind.InKeyword && token.Parent is FromClauseSyntax { Expression: QueryExpressionSyntax }; 381return token.Kind() == SyntaxKind.FromKeyword && 404if (expression.Kind() == SyntaxKind.SimpleAssignmentExpression) 432parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 451parent.IsKind(SyntaxKind.SimpleAssignmentExpression)) 466return (token1.Kind() == SyntaxKind.OpenParenToken && token2.Kind() == SyntaxKind.CloseParenToken) || 467(token1.Kind() == SyntaxKind.OpenBracketToken && token2.Kind() == SyntaxKind.CloseBracketToken); 472if (token.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 511if (token.Kind() is not SyntaxKind.PlusToken and not SyntaxKind.MinusToken) 520=> currentToken.Parent.IsKind(SyntaxKind.Interpolation); 527return currentToken.Kind() == SyntaxKind.OpenParenToken && currentToken is { Parent: ParenthesizedVariableDesignationSyntax, Parent.Parent: DeclarationExpressionSyntax }; 535return currentToken.IsKind(SyntaxKind.CommaToken) && 536currentToken.Parent.IsKind(SyntaxKind.TupleExpression); 541return currentToken.IsKind(SyntaxKind.CommaToken) && 542currentToken.Parent.IsKind(SyntaxKind.TupleType); 547return currentToken.IsKind(SyntaxKind.CommaToken) && 548currentToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation); 552=> token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.CollectionExpression); 559return !previousToken.TrailingTrivia.Any(SyntaxKind.EndOfLineTrivia) && !currentToken.LeadingTrivia.Any(SyntaxKind.EndOfLineTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\AnchorIndentationFormattingRule.cs (3)
20if (node.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression) 26if (node.IsKind(SyntaxKind.AnonymousMethodExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\BaseFormattingRule.cs (15)
24if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 37if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 51if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 65if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 80if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 116if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 126if (anchorToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None) 172else if (node.IsKind(SyntaxKind.PropertyPatternClause))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (62)
115currentToken.IsKind(SyntaxKind.WhereKeyword) && 116currentToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 130firstTokenAfterTypeConstraint.IsKind(SyntaxKind.WhereKeyword) && 131firstTokenAfterTypeConstraint.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 142currentToken.IsKind(SyntaxKind.OpenBraceToken) && 143currentToken.Parent.IsParentKind(SyntaxKind.IfStatement)) 176if (previousToken.Kind() != SyntaxKind.SemicolonToken) 179if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 182if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 216if (previousMember.Kind() is SyntaxKind.FieldDeclaration or 217SyntaxKind.EventFieldDeclaration) 293if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 310if (currentToken.Kind() == SyntaxKind.None) 317case SyntaxKind.None: 320case SyntaxKind.OpenBraceToken: 321case SyntaxKind.FinallyKeyword: 324case SyntaxKind.CloseBraceToken: 327case SyntaxKind.CloseParenToken: 329|| currentToken.Kind() == SyntaxKind.OpenBraceToken) ? 1 : 0; 331case SyntaxKind.CloseBracketToken: 337(parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.AssemblyKeyword) || 338parent.Target.Identifier.IsKindOrHasMatchingText(SyntaxKind.ModuleKeyword))) 340if (!currentToken.IsKind(SyntaxKind.EndOfFileToken) && !(currentToken.Parent is AttributeListSyntax)) 355case SyntaxKind.SemicolonToken: 358case SyntaxKind.CommaToken: 361case SyntaxKind.ElseKeyword: 362return currentToken.Kind() != SyntaxKind.IfKeyword ? 1 : 0; 364case SyntaxKind.ColonToken: 373if ((currentToken.Kind() == SyntaxKind.FromKeyword && currentToken.Parent.IsKind(SyntaxKind.FromClause)) || 374(currentToken.Kind() == SyntaxKind.LetKeyword && currentToken.Parent.IsKind(SyntaxKind.LetClause)) || 375(currentToken.Kind() == SyntaxKind.WhereKeyword && currentToken.Parent.IsKind(SyntaxKind.WhereClause)) || 376(currentToken.Kind() == SyntaxKind.JoinKeyword && currentToken.Parent.IsKind(SyntaxKind.JoinClause)) || 377(currentToken.Kind() == SyntaxKind.JoinKeyword && currentToken.Parent.IsKind(SyntaxKind.JoinIntoClause)) || 378(currentToken.Kind() == SyntaxKind.OrderByKeyword && currentToken.Parent.IsKind(SyntaxKind.OrderByClause)) || 379(currentToken.Kind() == SyntaxKind.SelectKeyword && currentToken.Parent.IsKind(SyntaxKind.SelectClause)) || 380(currentToken.Kind() == SyntaxKind.GroupKeyword && currentToken.Parent.IsKind(SyntaxKind.GroupClause))) 387case SyntaxKind.OpenBraceToken: 388case SyntaxKind.CloseBraceToken: 389case SyntaxKind.ElseKeyword: 390case SyntaxKind.FinallyKeyword: 393case SyntaxKind.OpenBracketToken: 399parent.Target.Identifier.Kind() is SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword && 416case SyntaxKind.WhereKeyword: 425if (nextToken.Kind() == SyntaxKind.CloseBraceToken) 430nextToken.Kind() is SyntaxKind.CatchKeyword or 431SyntaxKind.FinallyKeyword or 432SyntaxKind.ElseKeyword) 437nextToken.Kind() == SyntaxKind.WhileKeyword && 438nextToken.Parent.IsKind(SyntaxKind.DoStatement)) 442else if (nextToken.Kind() == SyntaxKind.EndOfFileToken) 458else if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 482return trivia.Kind() is SyntaxKind.WhitespaceTrivia 483or SyntaxKind.EndOfLineTrivia;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\EndOfFileTokenFormattingRule.cs (2)
17if (currentToken.Kind() == SyntaxKind.EndOfFileToken) 29if (currentToken.Kind() == SyntaxKind.EndOfFileToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (7)
95var firstStatementIsBlock = section.Statements is [(kind: SyntaxKind.Block), ..]; 222if (node.IsLambdaBodyBlock() || node.IsAnonymousMethodBlock() || node.Kind() is SyntaxKind.PropertyPatternClause or SyntaxKind.SwitchExpression) 228if (node.IsKind(SyntaxKind.ArrayInitializerExpression) && node.Parent != null && node.Parent.IsKind(SyntaxKind.ArrayCreationExpression)) 262if (node.Parent != null && node.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\NewLineUserSettingFormattingRule.cs (79)
44if (node.IsKind(SyntaxKind.SwitchStatement)) 53case SyntaxKind.IfStatement: 54case SyntaxKind.ElseClause: 55case SyntaxKind.WhileStatement: 56case SyntaxKind.DoStatement: 57case SyntaxKind.ForEachStatement: 58case SyntaxKind.ForEachVariableStatement: 59case SyntaxKind.UsingStatement: 60case SyntaxKind.ForStatement: 61case SyntaxKind.TryStatement: 62case SyntaxKind.CatchClause: 63case SyntaxKind.FinallyClause: 64case SyntaxKind.LockStatement: 65case SyntaxKind.CheckedStatement: 66case SyntaxKind.UncheckedStatement: 67case SyntaxKind.SwitchSection: 68case SyntaxKind.FixedStatement: 69case SyntaxKind.UnsafeStatement: 83if (previousToken.IsKind(SyntaxKind.CloseBraceToken) 84&& currentToken.IsKind(SyntaxKind.ElseKeyword) 94if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 103if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 112if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 121if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 130if (currentToken.IsKind(SyntaxKind.OpenBraceToken)) 132if (currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression 133or SyntaxKind.CollectionInitializerExpression 134or SyntaxKind.ArrayInitializerExpression 135or SyntaxKind.ImplicitArrayCreationExpression 136or SyntaxKind.WithInitializerExpression) 143else if (currentToken.Parent.IsKind(SyntaxKind.PropertyPatternClause)) 153var isFirstTokenOfSwitchArm = currentToken.Parent.IsParentKind(SyntaxKind.RecursivePattern, out RecursivePatternSyntax? recursivePattern) 154&& recursivePattern.IsParentKind(SyntaxKind.SwitchExpressionArm, out SwitchExpressionArmSyntax? switchExpressionArm) 170if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 183if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 192if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 201if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 210if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 211currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 220if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 229if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 249if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.ObjectInitializerExpression)) 263if (previousToken.IsKind(SyntaxKind.CommaToken) && previousToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 277if (previousToken.IsKind(SyntaxKind.CloseBraceToken) && currentToken.IsKind(SyntaxKind.ElseKeyword)) 291if (currentToken.IsKind(SyntaxKind.CatchKeyword)) 304if (currentToken.IsKind(SyntaxKind.FinallyKeyword)) 317if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent is BaseTypeDeclarationSyntax or NamespaceDeclarationSyntax) 330if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 346if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 347currentToken.Parent.Kind() is SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression or SyntaxKind.WithInitializerExpression or SyntaxKind.PropertyPatternClause) 363if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 364currentToken.Parent.Kind() is SyntaxKind.ArrayInitializerExpression or SyntaxKind.ImplicitArrayCreationExpression) 374if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 392if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent is AccessorDeclarationSyntax) 405if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.AnonymousMethodExpression)) 418if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentTokenParentParent.IsKind(SyntaxKind.LocalFunctionStatement)) 431if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && 432currentTokenParentParent is (kind: SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression)) 445if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && currentToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 458if (currentToken.IsKind(SyntaxKind.OpenBraceToken) && IsControlBlock(currentToken.Parent)) 473if (previousToken.IsKind(SyntaxKind.SemicolonToken) 474&& (previousToken.Parent is StatementSyntax && !previousToken.Parent.IsKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\QueryExpressionFormattingRule.cs (7)
169case SyntaxKind.FromKeyword: 170case SyntaxKind.WhereKeyword: 171case SyntaxKind.LetKeyword: 172case SyntaxKind.JoinKeyword: 173case SyntaxKind.OrderByKeyword: 174case SyntaxKind.GroupKeyword: 175case SyntaxKind.SelectKeyword:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SpacingFormattingRule.cs (165)
47var previousKind = previousToken.Kind(); 48var currentKind = currentToken.Kind(); 49var previousParentKind = previousToken.Parent.Kind(); 50var currentParentKind = currentToken.Parent.Kind(); 53if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.IdentifierToken) 65if (currentToken.IsOpenParenInParameterList() && previousKind == SyntaxKind.GreaterThanToken) 68if (currentToken.IsOpenParenInParameterListOfParenthesizedLambdaExpression() && previousParentKind == SyntaxKind.TypeArgumentList) 73if (previousParentKind == SyntaxKind.TypeParameterList) 85if ((previousToken.IsKeyword() || previousToken.Kind() is SyntaxKind.QuestionToken or SyntaxKind.AsteriskToken or SyntaxKind.CloseBracketToken or SyntaxKind.CloseParenToken or SyntaxKind.GreaterThanToken) 92if (previousToken.Parent.IsKind(SyntaxKind.OperatorDeclaration) && currentToken.IsOpenParenInParameterListOfAOperationDeclaration()) 137if (currentKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 142if (previousKind == SyntaxKind.OpenParenToken && IsFunctionLikeKeywordExpressionKind(previousParentKind)) 147if (currentKind == SyntaxKind.CloseParenToken && IsFunctionLikeKeywordExpressionKind(currentParentKind)) 153if (currentKind == SyntaxKind.OpenParenToken && 154(previousKind == SyntaxKind.IfKeyword || previousKind == SyntaxKind.WhileKeyword || previousKind == SyntaxKind.SwitchKeyword || 155previousKind == SyntaxKind.ForKeyword || previousKind == SyntaxKind.ForEachKeyword || previousKind == SyntaxKind.CatchKeyword || 156previousKind == SyntaxKind.UsingKeyword || previousKind == SyntaxKind.WhenKeyword || previousKind == SyntaxKind.LockKeyword || 157previousKind == SyntaxKind.FixedKeyword)) 163if ((previousToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && previousKind == SyntaxKind.OpenParenToken) || 164(currentToken.Parent.Kind() is SyntaxKind.ParenthesizedExpression or SyntaxKind.ParenthesizedPattern && currentKind == SyntaxKind.CloseParenToken)) 170if ((previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.OpenParenToken) || 171(currentParentKind == SyntaxKind.CastExpression && currentKind == SyntaxKind.CloseParenToken)) 177if (previousParentKind == SyntaxKind.ForStatement 180if (currentKind == SyntaxKind.SemicolonToken 181&& (previousKind != SyntaxKind.SemicolonToken 191if (previousKind == SyntaxKind.OpenParenToken && IsControlFlowLikeKeywordStatementKind(previousParentKind)) 196if (currentKind == SyntaxKind.CloseParenToken && IsControlFlowLikeKeywordStatementKind(currentParentKind)) 202if (previousParentKind == SyntaxKind.CastExpression && previousKind == SyntaxKind.CloseParenToken) 208if (currentKind == SyntaxKind.OpenBracketToken && currentToken.Parent.Kind() is SyntaxKind.ListPattern or SyntaxKind.CollectionExpression) 211if (previousKind == SyntaxKind.CommaToken) 217if (previousKind is not (SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken)) 224if (currentKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(currentToken) && !previousToken.IsOpenBraceOrCommaOfObjectInitializer()) 230if (((currentKind == SyntaxKind.CloseBracketToken && previousKind == SyntaxKind.OpenBracketToken) 231|| currentKind == SyntaxKind.OmittedArraySizeExpressionToken) 238if (previousKind == SyntaxKind.OpenBracketToken && HasFormattableBracketParent(previousToken)) 243if (currentKind == SyntaxKind.CloseBracketToken && previousKind != SyntaxKind.OmittedArraySizeExpressionToken && HasFormattableBracketParent(currentToken)) 249if (previousKind == SyntaxKind.CloseBracketToken && previousToken.Parent.IsKind(SyntaxKind.AttributeList)) 252if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 253currentToken.Parent.IsKind(SyntaxKind.AttributeList)) 259if (currentToken.IsKind(SyntaxKind.EndOfFileToken)) 292bool IsCommaWithCustomSpacing(SyntaxToken previousToken, SyntaxToken currentToken, SyntaxKind currentKind, SyntaxKind previousKind, bool checkPreviousToken) 295var tokenKind = checkPreviousToken ? previousKind : currentKind; 296var otherKind = checkPreviousToken ? currentKind : previousKind; 298return (token.IsCommaInArgumentOrParameterList() && otherKind != SyntaxKind.OmittedTypeArgumentToken) 304|| (tokenKind == SyntaxKind.CommaToken 305&& otherKind != SyntaxKind.OmittedArraySizeExpressionToken 322if (previousToken.IsSemicolonInForStatement() && currentKind != SyntaxKind.CloseParenToken) 338currentToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern || 339previousToken.Parent.Kind() is SyntaxKind.AndPattern or SyntaxKind.OrPattern or SyntaxKind.RelationalPattern) 346if (currentKind == SyntaxKind.IsKeyword || 347currentKind == SyntaxKind.AsKeyword || 348currentKind == SyntaxKind.AndKeyword || 349currentKind == SyntaxKind.OrKeyword || 350previousKind == SyntaxKind.IsKeyword || 351previousKind == SyntaxKind.AsKeyword || 352previousKind == SyntaxKind.AndKeyword || 353previousKind == SyntaxKind.OrKeyword) 371if (previousParentKind == SyntaxKind.FunctionPointerType) 374if (currentKind == SyntaxKind.AsteriskToken && previousKind == SyntaxKind.DelegateKeyword) 380if (previousKind == SyntaxKind.AsteriskToken && currentParentKind == SyntaxKind.FunctionPointerCallingConvention) 384case SyntaxKind.IdentifierToken: 385case SyntaxKind.ManagedKeyword: 386case SyntaxKind.UnmanagedKeyword: 392if (currentParentKind == SyntaxKind.FunctionPointerParameterList && currentKind == SyntaxKind.LessThanToken) 397case SyntaxKind.AsteriskToken: 400case SyntaxKind.ManagedKeyword: 401case SyntaxKind.UnmanagedKeyword: 404case SyntaxKind.CloseBracketToken when previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList: 411if (previousParentKind == SyntaxKind.FunctionPointerCallingConvention && currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && currentKind == SyntaxKind.OpenBracketToken) 417if (currentParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList && previousParentKind == SyntaxKind.FunctionPointerUnmanagedCallingConventionList) 419if (currentKind == SyntaxKind.IdentifierToken) 423if (previousKind == SyntaxKind.OpenBracketToken) 429else if (previousKind == SyntaxKind.CommaToken) 437if (currentKind == SyntaxKind.CommaToken) 444if (currentKind == SyntaxKind.CloseBracketToken) 452if (previousKind == SyntaxKind.LessThanToken && previousParentKind == SyntaxKind.FunctionPointerParameterList) 459if (currentKind == SyntaxKind.GreaterThanToken && currentParentKind == SyntaxKind.FunctionPointerParameterList) 465if (previousToken.Parent.IsKind(SyntaxKind.NotPattern)) 472if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.SlicePattern) 478if (previousKind is SyntaxKind.InterpolatedStringStartToken or 479SyntaxKind.InterpolatedVerbatimStringStartToken or 480SyntaxKind.InterpolatedSingleLineRawStringStartToken or 481SyntaxKind.InterpolatedMultiLineRawStringStartToken) 487if (currentKind is SyntaxKind.InterpolatedStringEndToken or 488SyntaxKind.InterpolatedRawStringEndToken) 494if ((currentKind == SyntaxKind.OpenBraceToken && currentToken.Parent is InterpolationSyntax) || 495(previousKind == SyntaxKind.CloseBraceToken && previousToken.Parent is InterpolationSyntax)) 501if (previousKind == SyntaxKind.OpenBraceToken && previousToken.Parent is InterpolationSyntax) 507if (currentKind == SyntaxKind.CloseBraceToken && currentToken.Parent is InterpolationSyntax interpolation) 518if ((previousKind == SyntaxKind.CommaToken && previousToken.Parent is InterpolationAlignmentClauseSyntax) || 519(currentKind == SyntaxKind.CommaToken && currentToken.Parent is InterpolationAlignmentClauseSyntax)) 525if ((previousKind == SyntaxKind.ColonToken && previousToken.Parent is InterpolationFormatClauseSyntax) || 526(currentKind == SyntaxKind.ColonToken && currentToken.Parent is InterpolationFormatClauseSyntax)) 538if (previousKind == SyntaxKind.CaretToken && previousParentKind == SyntaxKind.IndexExpression) 544if (previousKind == SyntaxKind.DotDotToken && previousParentKind == SyntaxKind.RangeExpression) 555if (currentKind == SyntaxKind.DotDotToken && currentParentKind == SyntaxKind.RangeExpression) 581is SyntaxKind.FieldDeclaration 582or SyntaxKind.EventDeclaration 583or SyntaxKind.EventFieldDeclaration 584or SyntaxKind.LocalDeclarationStatement 585or SyntaxKind.EnumMemberDeclaration) 610=> token.Parent is (kind: SyntaxKind.ArrayRankSpecifier or SyntaxKind.BracketedArgumentList or SyntaxKind.BracketedParameterList or SyntaxKind.ImplicitArrayCreationExpression or SyntaxKind.ListPattern or SyntaxKind.CollectionExpression); 612private static bool IsFunctionLikeKeywordExpressionKind(SyntaxKind syntaxKind) 613=> (syntaxKind is SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression); 615private static bool IsControlFlowLikeKeywordStatementKind(SyntaxKind syntaxKind) 617return syntaxKind is SyntaxKind.IfStatement or SyntaxKind.WhileStatement or SyntaxKind.SwitchStatement or 618SyntaxKind.ForStatement or SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement or 619SyntaxKind.DoStatement or 620SyntaxKind.CatchDeclaration or SyntaxKind.UsingStatement or SyntaxKind.LockStatement or 621SyntaxKind.FixedStatement or SyntaxKind.CatchFilterClause;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\StructuredTriviaFormattingRule.cs (8)
31((previousToken.Kind() == SyntaxKind.HashToken && currentToken.Kind() == SyntaxKind.ColonToken) || 32(previousToken.Kind() == SyntaxKind.ColonToken && currentToken.Kind() == SyntaxKind.StringLiteralToken))) 38if (previousToken.Kind() == SyntaxKind.HashToken && SyntaxFacts.IsPreprocessorKeyword(currentToken.Kind())) 43if (previousToken.Kind() == SyntaxKind.RegionKeyword && currentToken.Kind() == SyntaxKind.EndOfDirectiveToken) 48if (currentToken.Kind() == SyntaxKind.EndOfDirectiveToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (8)
80if (node.IsKind(SyntaxKind.SwitchExpressionArm)) 88if (node.IsKind(SyntaxKind.SwitchExpression)) 257if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 314if (!IsFormatDirective(pragmaWarningDirectiveTrivia, SyntaxKind.DisableKeyword)) 321var endDirective = pragmaWarningDirectiveTrivia.GetNextDirective(trivia => IsFormatDirective(trivia, SyntaxKind.RestoreKeyword)); 326Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None)); 332private static bool IsFormatDirective(DirectiveTriviaSyntax? trivia, SyntaxKind disableOrRestoreKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\TokenBasedFormattingRule.cs (101)
52case SyntaxKind.OpenBraceToken: 61case SyntaxKind.CloseBraceToken: 69if (previousToken.Kind() == SyntaxKind.CloseBraceToken && currentToken.Kind() == SyntaxKind.WhileKeyword) 77case SyntaxKind.CloseBraceToken: 83if (!currentToken.IsKind(SyntaxKind.SemicolonToken) && 103case SyntaxKind.OpenBraceToken: 144if (previousToken.Kind() == SyntaxKind.ElseKeyword) 146var isElseIfOnSameLine = currentToken.Kind() == SyntaxKind.IfKeyword && FormattingHelpers.AreOnSameLine(previousToken, currentToken); 165if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 170if (previousToken.Kind() == SyntaxKind.DoKeyword && previousToken.Parent.IsKind(SyntaxKind.DoStatement)) 182if (previousToken.Kind() == SyntaxKind.SemicolonToken && 183(currentToken.Kind() == SyntaxKind.CaseKeyword || currentToken.Kind() == SyntaxKind.DefaultKeyword || currentToken.Kind() == SyntaxKind.ElseKeyword)) 189if (previousToken.Kind() == SyntaxKind.SemicolonToken) 194if (currentToken.Kind() == SyntaxKind.SemicolonToken && 203if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 301if (usingDirective.StaticKeyword.IsKind(SyntaxKind.StaticKeyword)) 315if (currentToken.Kind() == SyntaxKind.SemicolonToken) 318if (previousToken.Kind() == SyntaxKind.SemicolonToken) 322if (previousToken.Kind() == SyntaxKind.CloseParenToken && previousToken.Parent.IsEmbeddedStatementOwnerWithCloseParen()) 330if (previousToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 331previousToken.Kind() == SyntaxKind.OmittedTypeArgumentToken || 332currentToken.Kind() == SyntaxKind.OmittedArraySizeExpressionToken || 333currentToken.Kind() == SyntaxKind.OmittedTypeArgumentToken) 338if (previousToken.IsKind(SyntaxKind.CloseBracketToken) && 339previousToken.Parent.IsKind(SyntaxKind.AttributeList) && 340previousToken.Parent.IsParentKind(SyntaxKind.Parameter)) 342if (currentToken.IsKind(SyntaxKind.OpenBracketToken)) 358if (currentToken.Kind() == SyntaxKind.OpenParenToken && 359previousToken.Kind() == SyntaxKind.ThisKeyword) 364if (previousToken.Kind() == SyntaxKind.NewKeyword) 369SyntaxKind.ConstructorConstraint or 370SyntaxKind.ImplicitObjectCreationExpression or 371SyntaxKind.ImplicitArrayCreationExpression) ? 0 : 1; 376if (currentToken.Kind() == SyntaxKind.OpenParenToken) 379is SyntaxKind.IdentifierToken 380or SyntaxKind.DefaultKeyword 381or SyntaxKind.BaseKeyword 382or SyntaxKind.ThisKeyword 384or SyntaxKind.ExtensionKeyword 401if (previousToken.Kind() == SyntaxKind.CommaToken && currentToken.Kind() == SyntaxKind.OpenBracketToken && currentToken.Parent is AttributeListSyntax) 407if (previousToken.Kind() == SyntaxKind.CloseBracketToken && previousToken.Parent is AttributeListSyntax) 420case SyntaxKind.CloseParenToken: 421case SyntaxKind.CloseBracketToken: 422case SyntaxKind.CommaToken: 423case SyntaxKind.DotToken: 424case SyntaxKind.MinusGreaterThanToken: 429if (currentToken.IsKind(SyntaxKind.OpenBracketToken) && 430currentToken.Parent?.Kind() is not SyntaxKind.CollectionExpression and not SyntaxKind.AttributeList && 448if (currentToken.IsKind(SyntaxKind.ColonToken) && 450SyntaxKind.AttributeTargetSpecifier or 451SyntaxKind.CaseSwitchLabel or 452SyntaxKind.CasePatternSwitchLabel or 453SyntaxKind.DefaultSwitchLabel or 454SyntaxKind.ExpressionColon or 458SyntaxKind.LabeledStatement or 459SyntaxKind.NameColon or 460SyntaxKind.SwitchExpressionArm)) 467previousToken.Kind() == SyntaxKind.CloseParenToken) 473if (previousToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList or SyntaxKind.FunctionPointerType)) 476if (previousToken.Kind() == SyntaxKind.LessThanToken) 482if (previousToken.Kind() == SyntaxKind.GreaterThanToken && currentToken.Kind() == SyntaxKind.GreaterThanToken) 489if ((currentToken.Kind() == SyntaxKind.LessThanToken || currentToken.Kind() == SyntaxKind.GreaterThanToken) && 490currentToken.Parent is (kind: SyntaxKind.TypeArgumentList or SyntaxKind.TypeParameterList)) 496if ((previousToken.Kind() == SyntaxKind.PlusPlusToken || previousToken.Kind() == SyntaxKind.MinusMinusToken) && 503if ((currentToken.Kind() == SyntaxKind.PlusPlusToken || currentToken.Kind() == SyntaxKind.MinusMinusToken) && 510if (currentToken.IsKind(SyntaxKind.QuestionToken) && currentToken.Parent.IsKind(SyntaxKind.ConditionalAccessExpression)) 516if (currentToken.Kind() == SyntaxKind.QuestionToken && 517currentToken.Parent is (kind: SyntaxKind.NullableType or SyntaxKind.ClassConstraint)) 523if (currentToken.IsKind(SyntaxKind.QuestionToken) && 524previousToken.Parent?.IsParentKind(SyntaxKind.ArrayType) == true) 530if (currentToken.Kind() == SyntaxKind.ExclamationToken && 531currentToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 537if (currentToken.Kind() == SyntaxKind.AsteriskToken && currentToken.Parent is PointerTypeSyntax) 543if (previousToken.Kind() == SyntaxKind.AsteriskToken && previousToken.Parent is PrefixUnaryExpressionSyntax) 551case SyntaxKind.OpenParenToken: 552case SyntaxKind.OpenBracketToken: 553case SyntaxKind.DotToken: 554case SyntaxKind.MinusGreaterThanToken: 557case SyntaxKind.CloseParenToken: 558case SyntaxKind.CloseBracketToken: 577if (previousToken.Kind() == SyntaxKind.ExclamationToken 578&& !previousToken.Parent.IsKind(SyntaxKind.SuppressNullableWarningExpression)) 584if (previousToken.Kind() == SyntaxKind.TildeToken && (previousToken.Parent is PrefixUnaryExpressionSyntax or DestructorDeclarationSyntax)) 590if (previousToken.Kind() == SyntaxKind.AmpersandToken && 597if (previousToken.Kind() == SyntaxKind.ColonColonToken || currentToken.Kind() == SyntaxKind.ColonColonToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\WrappingFormattingRule.cs (9)
70if (embeddedStatement.IsKind(SyntaxKind.Block)) 91if (!firstToken.IsKind(SyntaxKind.None) || !lastToken.IsKind(SyntaxKind.None)) 99if (node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block) 112if (!(node is not StatementSyntax statementNode || statementNode.Kind() == SyntaxKind.Block)) 121if (!tokens.firstToken.IsKind(SyntaxKind.None) || !tokens.lastToken.IsKind(SyntaxKind.None)) 179if (startToken.Kind() == SyntaxKind.None || endToken.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (14)
47Contract.ThrowIfTrue(startToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 48Contract.ThrowIfTrue(endToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 71return endToken.IsKind(SyntaxKind.CloseBraceToken) && 72endToken.Parent.IsKind(SyntaxKind.Block) && 73endToken.Parent.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.DoStatement; 78Contract.ThrowIfTrue(token.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 82if (previousToken.Kind() == SyntaxKind.None) 93if (token.IsKind(SyntaxKind.OpenBraceToken) && 98if (nextToken.IsKind(SyntaxKind.CloseBraceToken)) 107if (token.IsKind(SyntaxKind.OpenBraceToken) &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (12)
245modifiers.Any(SyntaxKind.PartialKeyword)) 286AssignmentExpressionSyntax _ when token.Kind() == SyntaxKind.EqualsToken => GetDeconstructionAssignmentMethods(semanticModel, node).As<ISymbol>(), 287ForEachVariableStatementSyntax _ when token.Kind() == SyntaxKind.InKeyword => GetDeconstructionForEachMethods(semanticModel, node).As<ISymbol>(), 310if (token.Kind() == SyntaxKind.CommaToken) 320if (ordering.AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 324else if (orderByClauseSyntax.Orderings[0].AscendingOrDescendingKeyword.Kind() == SyntaxKind.None) 343return token.IsKind(SyntaxKind.InKeyword) ? queryInfo.CastInfo.GetBestOrAllSymbols() : queryInfo.OperationInfo.GetBestOrAllSymbols(); 369if (token.IsKind(SyntaxKind.CommaToken)) 479SyntaxKind.IfDirectiveTrivia or 480SyntaxKind.ElifDirectiveTrivia or 481SyntaxKind.DefineDirectiveTrivia or 482SyntaxKind.UndefDirectiveTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpAccessibilityFacts.cs (53)
24case SyntaxKind.ClassDeclaration: 25case SyntaxKind.RecordDeclaration: 26case SyntaxKind.StructDeclaration: 27case SyntaxKind.RecordStructDeclaration: 28case SyntaxKind.InterfaceDeclaration: 29case SyntaxKind.EnumDeclaration: 30case SyntaxKind.DelegateDeclaration: 31return ignoreDeclarationModifiers || !((MemberDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.FileKeyword); 33case SyntaxKind.FieldDeclaration: 34case SyntaxKind.EventFieldDeclaration: 35case SyntaxKind.GetAccessorDeclaration: 36case SyntaxKind.SetAccessorDeclaration: 37case SyntaxKind.InitAccessorDeclaration: 38case SyntaxKind.AddAccessorDeclaration: 39case SyntaxKind.RemoveAccessorDeclaration: 42case SyntaxKind.VariableDeclaration: 45case SyntaxKind.VariableDeclarator: 48case SyntaxKind.ConstructorDeclaration: 50return ignoreDeclarationModifiers || !((ConstructorDeclarationSyntax)declaration).Modifiers.Any(SyntaxKind.StaticKeyword); 52case SyntaxKind.PropertyDeclaration: 55case SyntaxKind.IndexerDeclaration: 58case SyntaxKind.OperatorDeclaration: 61case SyntaxKind.ConversionOperatorDeclaration: 64case SyntaxKind.MethodDeclaration: 72if (method.Modifiers.Any(SyntaxKind.PartialKeyword)) 80case SyntaxKind.EventDeclaration: 108(SyntaxKind.PublicKeyword, _) => Accessibility.Public, 110(SyntaxKind.PrivateKeyword, Accessibility.Protected) => Accessibility.ProtectedAndInternal, 111(SyntaxKind.PrivateKeyword, _) => Accessibility.Private, 113(SyntaxKind.InternalKeyword, Accessibility.Protected) => Accessibility.ProtectedOrInternal, 114(SyntaxKind.InternalKeyword, _) => Accessibility.Internal, 116(SyntaxKind.ProtectedKeyword, Accessibility.Private) => Accessibility.ProtectedAndInternal, 117(SyntaxKind.ProtectedKeyword, Accessibility.Internal) => Accessibility.ProtectedOrInternal, 118(SyntaxKind.ProtectedKeyword, _) => Accessibility.Protected, 125SyntaxKind.AbstractKeyword => Modifiers.Abstract, 126SyntaxKind.NewKeyword => Modifiers.New, 127SyntaxKind.OverrideKeyword => Modifiers.Override, 128SyntaxKind.VirtualKeyword => Modifiers.Virtual, 129SyntaxKind.StaticKeyword => Modifiers.Static, 130SyntaxKind.AsyncKeyword => Modifiers.Async, 131SyntaxKind.ConstKeyword => Modifiers.Const, 132SyntaxKind.ReadOnlyKeyword => Modifiers.ReadOnly, 133SyntaxKind.SealedKeyword => Modifiers.Sealed, 134SyntaxKind.UnsafeKeyword => Modifiers.Unsafe, 135SyntaxKind.PartialKeyword => Modifiers.Partial, 136SyntaxKind.RefKeyword => Modifiers.Ref, 137SyntaxKind.VolatileKeyword => Modifiers.Volatile, 138SyntaxKind.ExternKeyword => Modifiers.Extern, 139SyntaxKind.FileKeyword => Modifiers.File, 141SyntaxKind.ClosedKeyword => Modifiers.Closed, 143SyntaxKind.RequiredKeyword => Modifiers.Required, 144SyntaxKind.FixedKeyword => Modifiers.Fixed, 148isDefault |= token.Kind() == SyntaxKind.DefaultKeyword;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpBlockFacts.cs (4)
22=> node.IsKind(SyntaxKind.Block); 25=> node is (kind: SyntaxKind.Block or SyntaxKind.SwitchSection or SyntaxKind.CompilationUnit);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpFileBannerFacts.cs (4)
22=> trivia.Kind() is SyntaxKind.SingleLineCommentTrivia or SyntaxKind.MultiLineCommentTrivia or SyntaxKind.SingleLineDocumentationCommentTrivia or SyntaxKind.MultiLineDocumentationCommentTrivia
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (175)
101var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 110var kind = token.Kind(); 149if (lineDirective.Line.Kind() == SyntaxKind.DefaultKeyword) 154else if (lineDirective.Line.Kind() == SyntaxKind.NumericLiteralToken && 201=> node is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList); 222=> node is LocalDeclarationStatementSyntax { UsingKeyword.RawKind: not (int)SyntaxKind.None }; 268=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.ThisConstructorInitializer) constructorInit && 272=> token.Parent is ConstructorInitializerSyntax(SyntaxKind.BaseConstructorInitializer) constructorInit && 282case SyntaxKind.FromKeyword: 283case SyntaxKind.JoinKeyword: 284case SyntaxKind.LetKeyword: 285case SyntaxKind.OrderByKeyword: 286case SyntaxKind.WhereKeyword: 287case SyntaxKind.OnKeyword: 288case SyntaxKind.EqualsKeyword: 289case SyntaxKind.InKeyword: 291case SyntaxKind.ByKeyword: 292case SyntaxKind.GroupKeyword: 293case SyntaxKind.SelectKeyword: 295case SyntaxKind.AscendingKeyword: 296case SyntaxKind.DescendingKeyword: 298case SyntaxKind.IntoKeyword: 299return token.Parent is (kind: SyntaxKind.JoinIntoClause or SyntaxKind.QueryContinuation); 326SyntaxKind.BoolKeyword => PredefinedType.Boolean, 327SyntaxKind.ByteKeyword => PredefinedType.Byte, 328SyntaxKind.SByteKeyword => PredefinedType.SByte, 329SyntaxKind.IntKeyword => PredefinedType.Int32, 330SyntaxKind.UIntKeyword => PredefinedType.UInt32, 331SyntaxKind.ShortKeyword => PredefinedType.Int16, 332SyntaxKind.UShortKeyword => PredefinedType.UInt16, 333SyntaxKind.LongKeyword => PredefinedType.Int64, 334SyntaxKind.ULongKeyword => PredefinedType.UInt64, 335SyntaxKind.FloatKeyword => PredefinedType.Single, 336SyntaxKind.DoubleKeyword => PredefinedType.Double, 337SyntaxKind.DecimalKeyword => PredefinedType.Decimal, 338SyntaxKind.StringKeyword => PredefinedType.String, 339SyntaxKind.CharKeyword => PredefinedType.Char, 340SyntaxKind.ObjectKeyword => PredefinedType.Object, 341SyntaxKind.VoidKeyword => PredefinedType.Void, 342SyntaxKind.IdentifierToken => token.Text switch 365switch ((SyntaxKind)token.RawKind) 367case SyntaxKind.PlusToken: 368case SyntaxKind.PlusEqualsToken: 371case SyntaxKind.MinusToken: 372case SyntaxKind.MinusEqualsToken: 375case SyntaxKind.AmpersandAmpersandToken: // overridden bitwise & can be accessed through && 376case SyntaxKind.AmpersandToken: 377case SyntaxKind.AmpersandEqualsToken: 380case SyntaxKind.BarBarToken: // overridden bitwise | can be accessed through || 381case SyntaxKind.BarToken: 382case SyntaxKind.BarEqualsToken: 385case SyntaxKind.MinusMinusToken: 388case SyntaxKind.PlusPlusToken: 391case SyntaxKind.SlashToken: 392case SyntaxKind.SlashEqualsToken: 395case SyntaxKind.EqualsEqualsToken: 398case SyntaxKind.CaretToken: 399case SyntaxKind.CaretEqualsToken: 402case SyntaxKind.GreaterThanToken: 405case SyntaxKind.GreaterThanEqualsToken: 408case SyntaxKind.ExclamationEqualsToken: 411case SyntaxKind.LessThanLessThanToken: 412case SyntaxKind.LessThanLessThanEqualsToken: 415case SyntaxKind.LessThanToken: 418case SyntaxKind.LessThanEqualsToken: 421case SyntaxKind.AsteriskToken: 422case SyntaxKind.AsteriskEqualsToken: 425case SyntaxKind.PercentToken: 426case SyntaxKind.PercentEqualsToken: 429case SyntaxKind.ExclamationToken: 430case SyntaxKind.TildeToken: 433case SyntaxKind.GreaterThanGreaterThanToken: 434case SyntaxKind.GreaterThanGreaterThanEqualsToken: 437case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 438case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 446=> SyntaxFacts.GetText((SyntaxKind)kind); 478case SyntaxKind.NumericLiteralToken: 479case SyntaxKind.CharacterLiteralToken: 480case SyntaxKind.StringLiteralToken: 481case SyntaxKind.Utf8StringLiteralToken: 482case SyntaxKind.SingleLineRawStringLiteralToken: 483case SyntaxKind.Utf8SingleLineRawStringLiteralToken: 484case SyntaxKind.MultiLineRawStringLiteralToken: 485case SyntaxKind.Utf8MultiLineRawStringLiteralToken: 486case SyntaxKind.NullKeyword: 487case SyntaxKind.TrueKeyword: 488case SyntaxKind.FalseKeyword: 489case SyntaxKind.InterpolatedStringStartToken: 490case SyntaxKind.InterpolatedStringEndToken: 491case SyntaxKind.InterpolatedRawStringEndToken: 492case SyntaxKind.InterpolatedVerbatimStringStartToken: 493case SyntaxKind.InterpolatedStringTextToken: 494case SyntaxKind.InterpolatedSingleLineRawStringStartToken: 495case SyntaxKind.InterpolatedMultiLineRawStringStartToken: 503=> token.Kind() is SyntaxKind.StringLiteralToken or SyntaxKind.InterpolatedStringTextToken; 511case SyntaxKind.DelegateKeyword: 512case SyntaxKind.VoidKeyword: 520if (token.Kind() == SyntaxKind.CommaToken && token.Parent.IsKind(SyntaxKind.OrderByClause)) 523if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CloseBracketToken) 525if (token.Parent.IsKind(SyntaxKind.CollectionExpression)) 545=> (node as MemberAccessExpressionSyntax)?.Kind() == SyntaxKind.PointerMemberAccessExpression; 555=> simpleName.IsKind(SyntaxKind.GenericName) || 556simpleName.GetLastToken().GetNextToken().Kind() == SyntaxKind.LessThanToken; 587=> node.IsKind(SyntaxKind.BaseList); 599=> node.IsKind(SyntaxKind.Argument); 602=> node.IsKind(SyntaxKind.AttributeArgument); 607argument.RefOrOutKeyword.Kind() == SyntaxKind.None && 635=> node.IsKind(SyntaxKind.IdentifierName) && 636node.IsParentKind(SyntaxKind.NameColon) && 637node.Parent.IsParentKind(SyntaxKind.Subpattern); 640=> node.Kind() == SyntaxKind.PropertyPatternClause; 649if (identifier.Parent.IsParentKind(SyntaxKind.WithInitializerExpression)) 655else if (identifier.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression)) 663else if (objectInitializer?.Parent is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) assignment) 694=> node.IsKind(SyntaxKind.ElementAccessExpression); 724var kind = node.Kind(); 725if ((kind != SyntaxKind.GlobalStatement) && (kind != SyntaxKind.IncompleteMember) && (node is TMemberDeclarationSyntax)) 816case SyntaxKind.CompilationUnit: 818case SyntaxKind.IdentifierName: 821case SyntaxKind.IncompleteMember: 823case SyntaxKind.NamespaceDeclaration: 824case SyntaxKind.FileScopedNamespaceDeclaration: 826case SyntaxKind.QualifiedName: 840if (memberDeclaration.Kind() == SyntaxKind.DestructorDeclaration) 865Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember); 1016if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) 1022if (token.Kind() == SyntaxKind.EndOfFileToken) 1091=> node?.Parent?.Kind() is SyntaxKind.PostIncrementExpression or SyntaxKind.PreIncrementExpression; 1094=> node?.Parent?.Kind() is SyntaxKind.PostDecrementExpression or SyntaxKind.PreDecrementExpression; 1107SyntaxKind.SingleLineRawStringLiteralToken or 1108SyntaxKind.MultiLineRawStringLiteralToken or 1109SyntaxKind.Utf8SingleLineRawStringLiteralToken or 1110SyntaxKind.Utf8MultiLineRawStringLiteralToken; 1113=> token.Kind() == SyntaxKind.NumericLiteralToken; 1139=> trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia; 1145=> node?.Kind() is SyntaxKind.UsingDirective or SyntaxKind.ExternAliasDirective; 1148=> IsGlobalAttribute(node, SyntaxKind.AssemblyKeyword); 1151=> IsGlobalAttribute(node, SyntaxKind.ModuleKeyword); 1153private static bool IsGlobalAttribute([NotNullWhen(true)] SyntaxNode? node, SyntaxKind attributeTarget) 1154=> node.IsKind(SyntaxKind.Attribute) && 1183case SyntaxKind.VariableDeclarator: 1184return node.Parent?.Parent?.Kind() is SyntaxKind.FieldDeclaration or SyntaxKind.EventFieldDeclaration; 1186case SyntaxKind.FieldDeclaration: 1187case SyntaxKind.MethodDeclaration: 1188case SyntaxKind.PropertyDeclaration: 1189case SyntaxKind.GetAccessorDeclaration: 1190case SyntaxKind.SetAccessorDeclaration: 1191case SyntaxKind.EventDeclaration: 1192case SyntaxKind.EventFieldDeclaration: 1193case SyntaxKind.AddAccessorDeclaration: 1194case SyntaxKind.RemoveAccessorDeclaration: 1195case SyntaxKind.IndexerDeclaration: 1196case SyntaxKind.OperatorDeclaration: 1197case SyntaxKind.ConversionOperatorDeclaration: 1198case SyntaxKind.ConstructorDeclaration: 1199case SyntaxKind.DestructorDeclaration: 1211=> node is ExpressionStatementSyntax { Expression: (kind: SyntaxKind.SimpleAssignmentExpression) }; 1332if (token.Kind() == SyntaxKind.OverrideKeyword && token.Parent is MemberDeclarationSyntax member) 1440=> node is InterpolatedStringExpressionSyntax { StringStartToken: (kind: SyntaxKind.InterpolatedVerbatimStringStartToken) }; 1482=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: IdentifierNameSyntax }; 1485=> node is AssignmentExpressionSyntax(SyntaxKind.SimpleAssignmentExpression) { Left: ImplicitElementAccessSyntax }; 1488=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression); 1491=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression); 1687=> node is InitializerExpressionSyntax(SyntaxKind.ObjectInitializerExpression) initExpr ? initExpr.Expressions : default; 1690=> node is InitializerExpressionSyntax(SyntaxKind.CollectionInitializerExpression) initExpr ? initExpr.Expressions : default;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxKinds.cs (151)
19=> (TSyntaxKind)(object)(SyntaxKind)kind; 23=> (int)(SyntaxKind)(object)kind; 25public int ConflictMarkerTrivia => (int)SyntaxKind.ConflictMarkerTrivia; 26public int DisabledTextTrivia => (int)SyntaxKind.DisabledTextTrivia; 27public int EndOfLineTrivia => (int)SyntaxKind.EndOfLineTrivia; 28public int SkippedTokensTrivia => (int)SyntaxKind.SkippedTokensTrivia; 29public int WhitespaceTrivia => (int)SyntaxKind.WhitespaceTrivia; 30public int SingleLineCommentTrivia => (int)SyntaxKind.SingleLineCommentTrivia; 31public int? MultiLineCommentTrivia => (int)SyntaxKind.MultiLineCommentTrivia; 32public int SingleLineDocCommentTrivia => (int)SyntaxKind.SingleLineDocumentationCommentTrivia; 33public int? MultiLineDocCommentTrivia => (int)SyntaxKind.MultiLineDocumentationCommentTrivia; 35public int IfDirectiveTrivia => (int)SyntaxKind.IfDirectiveTrivia; 36public int ElifDirectiveTrivia => (int)SyntaxKind.ElifDirectiveTrivia; 37public int ElseDirectiveTrivia => (int)SyntaxKind.ElseDirectiveTrivia; 38public int EndIfDirectiveTrivia => (int)SyntaxKind.EndIfDirectiveTrivia; 39public int RegionDirectiveTrivia => (int)SyntaxKind.RegionDirectiveTrivia; 40public int EndRegionDirectiveTrivia => (int)SyntaxKind.EndRegionDirectiveTrivia; 41public int? ShebangDirectiveTrivia => (int)SyntaxKind.ShebangDirectiveTrivia; 42public int DefineDirectiveTrivia => (int)SyntaxKind.DefineDirectiveTrivia; 43public int? UndefDirectiveTrivia => (int)SyntaxKind.UndefDirectiveTrivia; 45public int CloseBraceToken => (int)SyntaxKind.CloseBraceToken; 46public int? CloseBracketToken => (int)SyntaxKind.CloseBracketToken; 47public int CloseParenToken => (int)SyntaxKind.CloseParenToken; 48public int CommaToken => (int)SyntaxKind.CommaToken; 49public int ColonToken => (int)SyntaxKind.ColonToken; 50public int CharacterLiteralToken => (int)SyntaxKind.CharacterLiteralToken; 51public int DotToken => (int)SyntaxKind.DotToken; 52public int GreaterThanToken => (int)SyntaxKind.GreaterThanToken; 53public int InterpolatedStringTextToken => (int)SyntaxKind.InterpolatedStringTextToken; 54public int LessThanToken => (int)SyntaxKind.LessThanToken; 55public int LessThanSlashToken => (int)SyntaxKind.LessThanSlashToken; 56public int OpenBraceToken => (int)SyntaxKind.OpenBraceToken; 57public int? OpenBracketToken => (int)SyntaxKind.OpenBracketToken; 58public int OpenParenToken => (int)SyntaxKind.OpenParenToken; 59public int QuestionToken => (int)SyntaxKind.QuestionToken; 60public int StringLiteralToken => (int)SyntaxKind.StringLiteralToken; 61public int? SingleLineRawStringLiteralToken => (int)SyntaxKind.SingleLineRawStringLiteralToken; 62public int? MultiLineRawStringLiteralToken => (int)SyntaxKind.MultiLineRawStringLiteralToken; 63public int? Utf8StringLiteralToken => (int)SyntaxKind.Utf8StringLiteralToken; 64public int? Utf8SingleLineRawStringLiteralToken => (int)SyntaxKind.Utf8SingleLineRawStringLiteralToken; 65public int? Utf8MultiLineRawStringLiteralToken => (int)SyntaxKind.Utf8MultiLineRawStringLiteralToken; 67public int XmlCrefAttribute => (int)SyntaxKind.XmlCrefAttribute; 68public int XmlTextLiteralToken => (int)SyntaxKind.XmlTextLiteralToken; 70public int DelegateKeyword => (int)SyntaxKind.DelegateKeyword; 71public int FalseKeyword => (int)SyntaxKind.FalseKeyword; 72public int IfKeyword => (int)SyntaxKind.IfKeyword; 73public int NewKeyword => (int)SyntaxKind.NewKeyword; 74public int PartialKeyword => (int)SyntaxKind.PartialKeyword; 75public int TrueKeyword => (int)SyntaxKind.TrueKeyword; 76public int UsingKeyword => (int)SyntaxKind.UsingKeyword; 78public int? AliasQualifiedName => (int)SyntaxKind.AliasQualifiedName; 79public int GenericName => (int)SyntaxKind.GenericName; 80public int IdentifierName => (int)SyntaxKind.IdentifierName; 81public int QualifiedName => (int)SyntaxKind.QualifiedName; 83public int TupleType => (int)SyntaxKind.TupleType; 85public int CharacterLiteralExpression => (int)SyntaxKind.CharacterLiteralExpression; 86public int DefaultLiteralExpression => (int)SyntaxKind.DefaultLiteralExpression; 87public int FalseLiteralExpression => (int)SyntaxKind.FalseLiteralExpression; 88public int NullLiteralExpression => (int)SyntaxKind.NullLiteralExpression; 89public int NumericLiteralExpression => (int)SyntaxKind.NumericLiteralExpression; 90public int StringLiteralExpression => (int)SyntaxKind.StringLiteralExpression; 91public int TrueLiteralExpression => (int)SyntaxKind.TrueLiteralExpression; 93public int AddExpression => (int)SyntaxKind.AddExpression; 94public int AddressOfExpression => (int)SyntaxKind.AddressOfExpression; 95public int AnonymousObjectCreationExpression => (int)SyntaxKind.AnonymousObjectCreationExpression; 96public int ArrayCreationExpression => (int)SyntaxKind.ArrayCreationExpression; 97public int AwaitExpression => (int)SyntaxKind.AwaitExpression; 98public int BaseExpression => (int)SyntaxKind.BaseExpression; 99public int? CollectionExpression => (int)SyntaxKind.CollectionExpression; 100public int CollectionInitializerExpression => (int)SyntaxKind.CollectionInitializerExpression; 101public int ConditionalAccessExpression => (int)SyntaxKind.ConditionalAccessExpression; 102public int ConditionalExpression => (int)SyntaxKind.ConditionalExpression; 103public int? FieldExpression => (int)SyntaxKind.FieldExpression; 104public int? ImplicitArrayCreationExpression => (int)SyntaxKind.ImplicitArrayCreationExpression; 105public int? ImplicitObjectCreationExpression => (int)SyntaxKind.ImplicitObjectCreationExpression; 106public int? IndexExpression => (int)SyntaxKind.IndexExpression; 107public int InvocationExpression => (int)SyntaxKind.InvocationExpression; 108public int? IsPatternExpression => (int)SyntaxKind.IsPatternExpression; 109public int IsTypeExpression => (int)SyntaxKind.IsExpression; 111public int LogicalAndExpression => (int)SyntaxKind.LogicalAndExpression; 112public int LogicalOrExpression => (int)SyntaxKind.LogicalOrExpression; 113public int LogicalNotExpression => (int)SyntaxKind.LogicalNotExpression; 114public int ObjectCreationExpression => (int)SyntaxKind.ObjectCreationExpression; 115public int ParenthesizedExpression => (int)SyntaxKind.ParenthesizedExpression; 116public int QueryExpression => (int)SyntaxKind.QueryExpression; 117public int? RangeExpression => (int)SyntaxKind.RangeExpression; 118public int? RefExpression => (int)SyntaxKind.RefExpression; 119public int ReferenceEqualsExpression => (int)SyntaxKind.EqualsExpression; 120public int ReferenceNotEqualsExpression => (int)SyntaxKind.NotEqualsExpression; 121public int SimpleAssignmentExpression => (int)SyntaxKind.SimpleAssignmentExpression; 122public int SimpleMemberAccessExpression => (int)SyntaxKind.SimpleMemberAccessExpression; 123public int? SizeOfExpression => (int)SyntaxKind.SizeOfExpression; 124public int? SuppressNullableWarningExpression => (int)SyntaxKind.SuppressNullableWarningExpression; 125public int TernaryConditionalExpression => (int)SyntaxKind.ConditionalExpression; 126public int ThisExpression => (int)SyntaxKind.ThisExpression; 127public int? ThrowExpression => (int)SyntaxKind.ThrowExpression; 128public int TupleExpression => (int)SyntaxKind.TupleExpression; 129public int TypeOfExpression => (int)SyntaxKind.TypeOfExpression; 131public int? AndPattern => (int)SyntaxKind.AndPattern; 132public int? ConstantPattern => (int)SyntaxKind.ConstantPattern; 133public int? DeclarationPattern => (int)SyntaxKind.DeclarationPattern; 134public int? ListPattern => (int)SyntaxKind.ListPattern; 135public int? NotPattern => (int)SyntaxKind.NotPattern; 136public int? OrPattern => (int)SyntaxKind.OrPattern; 137public int? ParenthesizedPattern => (int)SyntaxKind.ParenthesizedPattern; 138public int? RecursivePattern => (int)SyntaxKind.RecursivePattern; 139public int? RelationalPattern => (int)SyntaxKind.RelationalPattern; 140public int? TypePattern => (int)SyntaxKind.TypePattern; 141public int? VarPattern => (int)SyntaxKind.VarPattern; 143public int EndOfFileToken => (int)SyntaxKind.EndOfFileToken; 144public int AwaitKeyword => (int)SyntaxKind.AwaitKeyword; 145public int AsyncKeyword => (int)SyntaxKind.AsyncKeyword; 146public int IdentifierToken => (int)SyntaxKind.IdentifierToken; 147public int GlobalKeyword => (int)SyntaxKind.GlobalKeyword; 148public int IncompleteMember => (int)SyntaxKind.IncompleteMember; 149public int HashToken => (int)SyntaxKind.HashToken; 151public int ExpressionStatement => (int)SyntaxKind.ExpressionStatement; 152public int ForEachStatement => (int)SyntaxKind.ForEachStatement; 153public int ForStatement => (int)SyntaxKind.ForStatement; 154public int IfStatement => (int)SyntaxKind.IfStatement; 155public int LocalDeclarationStatement => (int)SyntaxKind.LocalDeclarationStatement; 156public int? LocalFunctionStatement => (int)SyntaxKind.LocalFunctionStatement; 157public int LockStatement => (int)SyntaxKind.LockStatement; 158public int ReturnStatement => (int)SyntaxKind.ReturnStatement; 159public int ThrowStatement => (int)SyntaxKind.ThrowStatement; 160public int UsingStatement => (int)SyntaxKind.UsingStatement; 161public int WhileStatement => (int)SyntaxKind.WhileStatement; 162public int YieldReturnStatement => (int)SyntaxKind.YieldReturnStatement; 163public int Attribute => (int)SyntaxKind.Attribute; 164public int ClassDeclaration => (int)SyntaxKind.ClassDeclaration; 165public int ConstructorDeclaration => (int)SyntaxKind.ConstructorDeclaration; 166public int EnumDeclaration => (int)SyntaxKind.EnumDeclaration; 167public int InterfaceDeclaration => (int)SyntaxKind.InterfaceDeclaration; 168public int? StructDeclaration => (int)SyntaxKind.StructDeclaration; 169public int Parameter => (int)SyntaxKind.Parameter; 170public int TypeConstraint => (int)SyntaxKind.TypeConstraint; 171public int VariableDeclarator => (int)SyntaxKind.VariableDeclarator; 172public int FieldDeclaration => (int)SyntaxKind.FieldDeclaration; 173public int PropertyDeclaration => (int)SyntaxKind.PropertyDeclaration; 174public int ParameterList => (int)SyntaxKind.ParameterList; 175public int TypeArgumentList => (int)SyntaxKind.TypeArgumentList; 176public int? GlobalStatement => (int)SyntaxKind.GlobalStatement; 178public int ElseClause => (int)SyntaxKind.ElseClause; 179public int EqualsValueClause => (int)SyntaxKind.EqualsValueClause; 181public int? ExpressionElement => (int)SyntaxKind.ExpressionElement; 182public int? ImplicitElementAccess => (int)SyntaxKind.ImplicitElementAccess; 183public int Interpolation => (int)SyntaxKind.Interpolation; 184public int InterpolatedStringExpression => (int)SyntaxKind.InterpolatedStringExpression; 185public int InterpolatedStringText => (int)SyntaxKind.InterpolatedStringText; 186public int? IndexerMemberCref => (int)SyntaxKind.IndexerMemberCref; 187public int? PrimaryConstructorBaseType => (int)SyntaxKind.PrimaryConstructorBaseType;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (1)
14if (node.NameColon == null || !node.Parent.IsKind(SyntaxKind.TupleExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (21)
56return cast.Kind() == SyntaxKind.AsExpression && 126if (leftOrRightChild.Parent is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) binary) 160if (castExpression.WalkUpParentheses().Parent is PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression) parent && 187var isDefaultLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression); 231if (castSyntax.WalkUpParentheses().GetRequiredParent().Kind() is SyntaxKind.BitwiseOrExpression or SyntaxKind.OrAssignmentExpression) 334var isNullLiteralCast = castedExpressionNode.WalkDownParentheses().IsKind(SyntaxKind.NullLiteralExpression); 504if (castNode.WalkUpParentheses().Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) isExpression && 570if (castNode.IsParentKind(SyntaxKind.Interpolation) && originalConversionOperation.Type?.SpecialType is SpecialType.System_Object) 815if (parent is not PrefixUnaryExpressionSyntax(SyntaxKind.BitwiseNotExpression)) 820Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 947if (armExpression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 998if (castExpression.Expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 1063is BinaryExpressionSyntax(SyntaxKind.EqualsExpression or SyntaxKind.NotEqualsExpression) parentBinary) 1151=> node is ExpressionSyntax expression && expression.WalkDownParentheses().Kind() is SyntaxKind.CastExpression or SyntaxKind.AsExpression; 1188if (otherSide.WalkDownParentheses().Kind() == SyntaxKind.NullLiteralExpression) 1257else if (castNode.Parent is InitializerExpressionSyntax(SyntaxKind.ArrayInitializerExpression) arrayInitializer) 1365if (!haveHitArgumentNode && currentOld.Kind() != SyntaxKind.Argument)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (46)
22Contract.ThrowIfTrue(endToken.Kind() == SyntaxKind.None); 40while (currentToken.Kind() != SyntaxKind.CloseBraceToken && previousToken.Kind() == SyntaxKind.OpenBraceToken) 43if (closeBrace.Kind() == SyntaxKind.None || !AreTwoTokensOnSameLine(previousToken, closeBrace)) 60case SyntaxKind.CloseBraceToken: 63case SyntaxKind.SemicolonToken: 66case SyntaxKind.ColonToken: 76if (endToken.Kind() == SyntaxKind.SkippedTokensTrivia) 88if (parent.Kind() is SyntaxKind.StringLiteralExpression or SyntaxKind.CharacterLiteralExpression) 100if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 152if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 252if (parent == null || parent.Kind() == SyntaxKind.SkippedTokensTrivia) 259if (endToken.Kind() == SyntaxKind.ColonToken && parent is LabeledStatementSyntax) 268return previousToken.Kind() == SyntaxKind.None ? token : previousToken; 290if (previousToken.Kind() == SyntaxKind.None) 327return previousToken.IsKind(SyntaxKind.OpenBraceToken) && 328(previousToken.Parent.IsKind(SyntaxKind.Block) || 336node.Kind() is SyntaxKind.IfStatement or 337SyntaxKind.ElseClause or 338SyntaxKind.WhileStatement or 339SyntaxKind.ForStatement or 340SyntaxKind.ForEachStatement or 341SyntaxKind.ForEachVariableStatement or 342SyntaxKind.UsingStatement or 343SyntaxKind.DoStatement or 344SyntaxKind.TryStatement or 345SyntaxKind.CatchClause or 346SyntaxKind.FinallyClause or 347SyntaxKind.LabeledStatement or 348SyntaxKind.LockStatement or 349SyntaxKind.FixedStatement or 350SyntaxKind.UncheckedStatement or 351SyntaxKind.CheckedStatement or 352SyntaxKind.GetAccessorDeclaration or 353SyntaxKind.SetAccessorDeclaration or 354SyntaxKind.InitAccessorDeclaration or 355SyntaxKind.AddAccessorDeclaration or 356SyntaxKind.RemoveAccessorDeclaration; 388return token.Kind() == SyntaxKind.ColonToken && 395if (previousToken.Kind() is not SyntaxKind.SemicolonToken and not SyntaxKind.CloseBraceToken) 400if (currentToken.Kind() == SyntaxKind.CloseBraceToken) 417if (token.Kind() == SyntaxKind.CloseBraceToken) 419if (token.Parent.Kind() is SyntaxKind.Block or 420SyntaxKind.AccessorList)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\NameSyntaxComparer.cs (4)
84case SyntaxKind.QualifiedName: 89case SyntaxKind.AliasQualifiedName: 94case SyntaxKind.IdentifierName: 97case SyntaxKind.GenericName:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (57)
69=> expression.Kind() is SyntaxKind.ThisExpression or SyntaxKind.BaseExpression; 82if (node.Kind() is not SyntaxKind.PrimaryConstructorBaseType || 83previousNode.Kind() is SyntaxKind.ArgumentList) 96=> node is StatementSyntax(kind: not SyntaxKind.Block) or TypeSyntax or CrefSyntax || 97node.Kind() is SyntaxKind.Attribute or 98SyntaxKind.ThisConstructorInitializer or 99SyntaxKind.BaseConstructorInitializer or 100SyntaxKind.EqualsValueClause or 101SyntaxKind.ArrowExpressionClause or 102SyntaxKind.PrimaryConstructorBaseType; 109node => node.Kind() is SyntaxKind.UnknownAccessorDeclaration or SyntaxKind.IncompleteMember or SyntaxKind.BracketedArgumentList), 158case SyntaxKind.Attribute: 162case SyntaxKind.BaseConstructorInitializer: 163case SyntaxKind.ThisConstructorInitializer: 167case SyntaxKind.EqualsValueClause: 171case SyntaxKind.ArrowExpressionClause: 175case SyntaxKind.PrimaryConstructorBaseType: 201case SyntaxKind.ParenthesizedLambdaExpression: 235case SyntaxKind.SimpleLambdaExpression: 300if (currentOriginalNode.Kind() is SyntaxKind.CaseSwitchLabel or SyntaxKind.ConstantPattern) 303if (expression.WalkDownParentheses().IsKind(SyntaxKind.DefaultLiteralExpression)) 315else if (currentOriginalNode.Kind() == SyntaxKind.LogicalNotExpression) 319else if (currentOriginalNode.Kind() == SyntaxKind.ConditionalAccessExpression) 336else if (currentOriginalNode.Kind() == SyntaxKind.VariableDeclarator) 467if (previousReplacedExpression.WalkDownParentheses().Kind() is SyntaxKind.NullLiteralExpression or SyntaxKind.DefaultLiteralExpression) 515else if (currentOriginalNode.Kind() == SyntaxKind.CollectionInitializerExpression) 520else if (currentOriginalNode.Kind() == SyntaxKind.ImplicitArrayCreationExpression) 529else if (currentOriginalNode.Kind() == SyntaxKind.DefaultExpression) 582SyntaxKind.InvocationExpression or 583SyntaxKind.ElementAccessExpression or 584SyntaxKind.SimpleMemberAccessExpression or 585SyntaxKind.ImplicitElementAccess or 586SyntaxKind.ObjectCreationExpression; 602SyntaxKind.InvocationExpression => ((InvocationExpressionSyntax)expression).ArgumentList, 603SyntaxKind.ObjectCreationExpression => ((ObjectCreationExpressionSyntax)expression).ArgumentList, 604SyntaxKind.ElementAccessExpression => ((ElementAccessExpressionSyntax)expression).ArgumentList, 615case SyntaxKind.SimpleMemberAccessExpression: 618case SyntaxKind.InvocationExpression: 621if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 629case SyntaxKind.ElementAccessExpression: 632if (result.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 663=> node.IsKind(SyntaxKind.ParenthesizedExpression); 673if (binaryExpression.Kind() is SyntaxKind.AsExpression or SyntaxKind.IsExpression && 720assignmentExpression.Kind() != SyntaxKind.LeftShiftAssignmentExpression && 721assignmentExpression.Kind() != SyntaxKind.RightShiftAssignmentExpression && 773if (newExpression.IsKind(SyntaxKind.ConditionalExpression) && 783if (newExpression.IsKind(SyntaxKind.SwitchExpression) && 793if (newExpression.IsKind(SyntaxKind.CollectionExpression) && 802if (newExpression.IsKind(SyntaxKind.TupleExpression) && 818if (originalExpression.IsKind(SyntaxKind.ConditionalExpression) && 819newExpression.IsKind(SyntaxKind.ConditionalExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TokenComparer.cs (4)
23x.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword && 24y.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.UsingKeyword or SyntaxKind.StaticKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (9)
38if (typeName?.FirstAncestorOrSelf<SyntaxNode>(a => a.Kind() is SyntaxKind.DeclarationExpression or SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement) is not { } declaration) 61Debug.Assert(node.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression); 84SyntaxKind.LocalDeclarationStatement or 85SyntaxKind.ForStatement or 86SyntaxKind.UsingStatement);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.State.cs (1)
104/// to var. <see cref="SyntaxFacts.IsPredefinedType(SyntaxKind)"/> considers string
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseExplicitTypeHelper.cs (4)
66declExpression.Designation.IsKind(SyntaxKind.ParenthesizedVariableDesignation)) 78if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) })
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpUseImplicitTypeHelper.cs (6)
104if (typeName is { Parent: VariableDeclarationSyntax variableDeclaration, Parent.Parent: (kind: SyntaxKind.LocalDeclarationStatement or SyntaxKind.ForStatement or SyntaxKind.UsingStatement) }) 117if (!variableDeclaration.Type.IsKind(SyntaxKind.PointerType) && 248if (expression.IsKind(SyntaxKind.NullLiteralExpression)) 252if (expression.IsKind(SyntaxKind.ImplicitObjectCreationExpression))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeSyntaxComparer.cs (3)
47case SyntaxKind.ArrayType: 50case SyntaxKind.PointerType: 53case SyntaxKind.NullableType:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (5)
29.Select(n => n.GetTrailingTrivia().FirstOrNull(t => t.Kind() == SyntaxKind.EndOfLineTrivia)) 71var directive1IsUsingStatic = using1.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 72var directive2IsUsingStatic = using2.StaticKeyword.IsKind(SyntaxKind.StaticKeyword); 170if (!trailingTrivia.Any() || trailingTrivia.Last().Kind() != SyntaxKind.EndOfLineTrivia) 188=> node.WithLeadingTrivia(node.GetLeadingTrivia().SkipWhile(t => t.Kind() == SyntaxKind.EndOfLineTrivia));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ConstructorGenerator.cs (3)
95var kind = CodeGenerationConstructorInfo.GetThisConstructorArgumentsOpt(constructor) != null 96? SyntaxKind.ThisConstructorInitializer 97: SyntaxKind.BaseConstructorInitializer;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (12)
95if (t1.Kind() == SyntaxKind.MultiLineCommentTrivia) 100return SyntaxTrivia(SyntaxKind.MultiLineCommentTrivia, text + MultiLineCommentTerminator); 103else if (t1.Kind() == SyntaxKind.SkippedTokensTrivia) 196=> declaration.ChildTokens().Where(t => t.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CloseBraceToken && t.IsMissing).Any(); 233SyntaxKind.ClassDeclaration => CodeGenerationDestination.ClassType, 234SyntaxKind.CompilationUnit => CodeGenerationDestination.CompilationUnit, 235SyntaxKind.EnumDeclaration => CodeGenerationDestination.EnumType, 236SyntaxKind.InterfaceDeclaration => CodeGenerationDestination.InterfaceType, 237SyntaxKind.FileScopedNamespaceDeclaration => CodeGenerationDestination.Namespace, 238SyntaxKind.NamespaceDeclaration => CodeGenerationDestination.Namespace, 239SyntaxKind.StructDeclaration => CodeGenerationDestination.StructType,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationService.cs (20)
457ComputePositionAndTriviaForRemoveAttributeList(attributeList, t => t.IsKind(SyntaxKind.EndOfLineTrivia), out positionOfRemovedNode, out trivia); 463ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, t => t.IsKind(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia); 511var insertionIndex = compilationUnit.Members.LastIndexOf(memberDeclaration => memberDeclaration.IsKind(SyntaxKind.GlobalStatement)) + 1; 515else if (destinationMember is StatementSyntax statement && statement.IsParentKind(SyntaxKind.GlobalStatement)) 786case SyntaxKind.DelegateDeclaration: 794case SyntaxKind.MethodDeclaration: 802case SyntaxKind.OperatorDeclaration: 810case SyntaxKind.ConversionOperatorDeclaration: 818case SyntaxKind.PropertyDeclaration: 826case SyntaxKind.EventDeclaration: 834case SyntaxKind.IndexerDeclaration: 842case SyntaxKind.Parameter: 856case SyntaxKind.IncompleteMember: 870case SyntaxKind.ArrayType: 878case SyntaxKind.PointerType: 886case SyntaxKind.VariableDeclaration: 894case SyntaxKind.CatchDeclaration: 918case SyntaxKind.CompilationUnit: 919case SyntaxKind.NamespaceDeclaration: 920case SyntaxKind.FileScopedNamespaceDeclaration:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpDeclarationComparer.cs (78)
15private static readonly Dictionary<SyntaxKind, int> s_kindPrecedenceMap = new(SyntaxFacts.EqualityComparer) 17{ SyntaxKind.FieldDeclaration, 0 }, 18{ SyntaxKind.ConstructorDeclaration, 1 }, 19{ SyntaxKind.DestructorDeclaration, 2 }, 20{ SyntaxKind.IndexerDeclaration, 3 }, 21{ SyntaxKind.PropertyDeclaration, 4 }, 22{ SyntaxKind.EventFieldDeclaration, 5 }, 23{ SyntaxKind.EventDeclaration, 6 }, 24{ SyntaxKind.MethodDeclaration, 7 }, 25{ SyntaxKind.OperatorDeclaration, 8 }, 26{ SyntaxKind.ConversionOperatorDeclaration, 9 }, 27{ SyntaxKind.EnumDeclaration, 10 }, 28{ SyntaxKind.InterfaceDeclaration, 11 }, 29{ SyntaxKind.StructDeclaration, 12 }, 30{ SyntaxKind.ClassDeclaration, 13 }, 31{ SyntaxKind.RecordDeclaration, 14 }, 32{ SyntaxKind.RecordStructDeclaration, 15 }, 33{ SyntaxKind.DelegateDeclaration, 16 } 36private static readonly Dictionary<SyntaxKind, int> s_operatorPrecedenceMap = new(SyntaxFacts.EqualityComparer) 38{ SyntaxKind.PlusToken, 0 }, 39{ SyntaxKind.MinusToken, 1 }, 40{ SyntaxKind.ExclamationToken, 2 }, 41{ SyntaxKind.TildeToken, 3 }, 42{ SyntaxKind.PlusPlusToken, 4 }, 43{ SyntaxKind.MinusMinusToken, 5 }, 44{ SyntaxKind.AsteriskToken, 6 }, 45{ SyntaxKind.SlashToken, 7 }, 46{ SyntaxKind.PercentToken, 8 }, 47{ SyntaxKind.AmpersandToken, 9 }, 48{ SyntaxKind.BarToken, 10 }, 49{ SyntaxKind.CaretToken, 11 }, 50{ SyntaxKind.LessThanLessThanToken, 12 }, 51{ SyntaxKind.GreaterThanGreaterThanToken, 13 }, 52{ SyntaxKind.EqualsEqualsToken, 14 }, 53{ SyntaxKind.ExclamationEqualsToken, 15 }, 54{ SyntaxKind.LessThanToken, 16 }, 55{ SyntaxKind.GreaterThanToken, 17 }, 56{ SyntaxKind.LessThanEqualsToken, 18 }, 57{ SyntaxKind.GreaterThanEqualsToken, 19 }, 58{ SyntaxKind.TrueKeyword, 20 }, 59{ SyntaxKind.FalseKeyword, 21 }, 60{ SyntaxKind.GreaterThanGreaterThanGreaterThanToken, 22 }, 103case SyntaxKind.DelegateDeclaration: 106case SyntaxKind.FieldDeclaration: 107case SyntaxKind.EventFieldDeclaration: 110case SyntaxKind.ConstructorDeclaration: 113case SyntaxKind.DestructorDeclaration: 117case SyntaxKind.MethodDeclaration: 120case SyntaxKind.OperatorDeclaration: 123case SyntaxKind.EventDeclaration: 126case SyntaxKind.IndexerDeclaration: 129case SyntaxKind.PropertyDeclaration: 132case SyntaxKind.EnumDeclaration: 135case SyntaxKind.InterfaceDeclaration: 136case SyntaxKind.StructDeclaration: 137case SyntaxKind.RecordStructDeclaration: 138case SyntaxKind.ClassDeclaration: 139case SyntaxKind.RecordDeclaration: 142case SyntaxKind.ConversionOperatorDeclaration: 145case SyntaxKind.IncompleteMember: 148case SyntaxKind.GlobalStatement: 217return x.ImplicitOrExplicitKeyword.Kind() == SyntaxKind.ImplicitKeyword ? -1 : 1; 301private static bool ContainsToken(SyntaxTokenList list, SyntaxKind kind) 316if (ContainsToken(modifiers, SyntaxKind.PublicKeyword)) 320else if (ContainsToken(modifiers, SyntaxKind.ProtectedKeyword)) 322if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 327if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 334else if (ContainsToken(modifiers, SyntaxKind.InternalKeyword)) 338else if (ContainsToken(modifiers, SyntaxKind.PrivateKeyword)) 347if (node.Kind() == SyntaxKind.InterfaceDeclaration) 352else if (node.Kind() is SyntaxKind.StructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration) 362private static bool BothHaveModifier(SyntaxTokenList x, SyntaxTokenList y, SyntaxKind modifierKind, out int comparisonResult) 378=> BothHaveModifier(x, y, SyntaxKind.StaticKeyword, out comparisonResult); 381=> BothHaveModifier(x, y, SyntaxKind.ConstKeyword, out comparisonResult); 384=> BothHaveModifier(x, y, SyntaxKind.ReadOnlyKeyword, out comparisonResult);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EnumMemberGenerator.cs (9)
34else if (members.LastOrDefault().Kind() == SyntaxKind.CommaToken) 118if (lastExpression.Kind() == SyntaxKind.LeftShiftExpression && 122if (binaryExpression.Left.Kind() == SyntaxKind.NumericLiteralExpression) 132SyntaxKind.LeftShiftExpression, 133LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(numericLiteral.Token.Text, 1)), 134LiteralExpression(SyntaxKind.NumericLiteralExpression, Literal(shiftValue.ToString(), shiftValue))); 138else if (lastExpression is LiteralExpressionSyntax(SyntaxKind.NumericLiteralExpression) numericLiteral) 146return LiteralExpression(SyntaxKind.NumericLiteralExpression, 151return LiteralExpression(SyntaxKind.NumericLiteralExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\EventGenerator.cs (7)
28if (eventDeclaration.Kind() == SyntaxKind.EventFieldDeclaration) 36if (eventDeclaration.Kind() == SyntaxKind.EventDeclaration) 53if (eventDeclaration.Kind() == SyntaxKind.FieldDeclaration) 164GenerateAccessorDeclaration(@event, @event.AddMethod, SyntaxKind.AddAccessorDeclaration, destination, info), 165GenerateAccessorDeclaration(@event, @event.RemoveMethod, SyntaxKind.RemoveAccessorDeclaration, destination, info), 174SyntaxKind kind, 186SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\ExpressionGenerator.cs (18)
42InitializerExpression(SyntaxKind.ArrayInitializerExpression, 51=> LiteralExpression(SyntaxKind.NullLiteralExpression); 108? SyntaxKind.TrueLiteralExpression 109: SyntaxKind.FalseLiteralExpression); 116SyntaxKind.StringLiteralExpression, Literal(valueString, val)); 123SyntaxKind.CharacterLiteralExpression, Literal(literal, val)); 186return BinaryExpression(SyntaxKind.DivideExpression, 192return BinaryExpression(SyntaxKind.DivideExpression, 198return BinaryExpression(SyntaxKind.DivideExpression, 199PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateDoubleLiteralExpression(null, 1.0, false)), 215return BinaryExpression(SyntaxKind.DivideExpression, 221return BinaryExpression(SyntaxKind.DivideExpression, 227return BinaryExpression(SyntaxKind.DivideExpression, 228PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, GenerateSingleLiteralExpression(null, 1.0F, false)), 279SyntaxKind.NumericLiteralExpression, tokenFactory(stringValue, nonNegativeValue)); 282? PrefixUnaryExpression(SyntaxKind.UnaryMinusExpression, literal) 299var result = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, memberAccess, IdentifierName(constant.Value)); 315: MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, result, name);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\FieldGenerator.cs (6)
28.Where(f => f.Modifiers.Any(SyntaxKind.ConstKeyword)) 33if (fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword)) 39.Where(f => f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)) 43.Where(f => !f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword) && !f.Modifiers.Any(SyntaxKind.ConstKeyword)) 48return fieldDeclaration.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (2)
26private static readonly TypeParameterConstraintSyntax s_classConstraint = ClassOrStructConstraint(SyntaxKind.ClassConstraint); 27private static readonly TypeParameterConstraintSyntax s_structConstraint = ClassOrStructConstraint(SyntaxKind.StructConstraint);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (14)
168case SyntaxKind.EnumDeclaration: 171case SyntaxKind.StructDeclaration: 172case SyntaxKind.RecordStructDeclaration: 173case SyntaxKind.InterfaceDeclaration: 174case SyntaxKind.ClassDeclaration: 175case SyntaxKind.RecordDeclaration: 201var declarationKind = isRecordClass ? SyntaxKind.RecordDeclaration : SyntaxKind.RecordStructDeclaration; 202var classOrStructKeyword = Token(isRecordClass ? default : SyntaxKind.StructKeyword); 211var kind = namedType.TypeKind == TypeKind.Struct ? SyntaxKind.StructDeclaration : 212namedType.TypeKind == TypeKind.Interface ? SyntaxKind.InterfaceDeclaration : SyntaxKind.ClassDeclaration;
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\OperatorGenerator.cs (2)
82var operatorSyntaxKind = SyntaxFacts.GetOperatorKind(method.MetadataName); 83if (operatorSyntaxKind == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\PropertyGenerator.cs (8)
185if (accessor.IsKind(SyntaxKind.GetAccessorDeclaration)) 252SyntaxKind declarationKind, AccessorDeclarationSyntax accessor, LanguageVersion languageVersion, ExpressionBodyPreference preference, CancellationToken cancellationToken, 279var setAccessorKind = property.SetMethod?.IsInitOnly == true ? SyntaxKind.InitAccessorDeclaration : SyntaxKind.SetAccessorDeclaration; 282GenerateAccessorDeclaration(property, property.GetMethod, SyntaxKind.GetAccessorDeclaration, destination, info, cancellationToken), 294SyntaxKind kind, 308SyntaxKind kind,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Editing\CSharpImportAdder.cs (7)
164case SyntaxKind.IdentifierName: 165case SyntaxKind.GenericName: 169case SyntaxKind.SimpleMemberAccessExpression: 170case SyntaxKind.PointerMemberAccessExpression: 174case SyntaxKind.SimpleLambdaExpression: 175case SyntaxKind.ParenthesizedLambdaExpression: 176case SyntaxKind.AnonymousMethodExpression:
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\BasePropertyDeclarationSyntaxExtensions.cs (4)
21case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).SemicolonToken; 22case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).SemicolonToken; 39case SyntaxKind.PropertyDeclaration: return ((PropertyDeclarationSyntax)node).WithSemicolonToken(semicolonToken); 40case SyntaxKind.IndexerDeclaration: return ((IndexerDeclarationSyntax)node).WithSemicolonToken(semicolonToken);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (4)
130Debug.Assert(!endOfLine.IsKind(SyntaxKind.None)); 131if (!endOfLine.IsKind(SyntaxKind.None)) 150if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.IfDirectiveTrivia))) 155if (root.Usings[i].GetLeadingTrivia().Any(trivia => trivia.IsKind(SyntaxKind.EndIfDirectiveTrivia)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\CSharpSyntaxContext.cs (42)
48public readonly ISet<SyntaxKind> PrecedingModifiers; 111ISet<SyntaxKind> precedingModifiers, 213targetToken.IsKind(SyntaxKind.TildeToken) && 214targetToken.Parent.IsKind(SyntaxKind.DestructorDeclaration) && 215targetToken.Parent.Parent is (kind: SyntaxKind.ClassDeclaration or SyntaxKind.RecordDeclaration); 224var isOnArgumentListBracketOrComma = targetToken.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.AttributeArgumentList or SyntaxKind.ArrayRankSpecifier); 246isCrefContext: syntaxTree.IsCrefContext(position, cancellationToken) && !leftToken.IsKind(SyntaxKind.DotToken), 263isTaskLikeTypeContext: precedingModifiers.Contains(SyntaxKind.AsyncKeyword), 312if (token.Kind() == SyntaxKind.OpenBracketToken && 313token.Parent.IsKind(SyntaxKind.AttributeList) && 324ISet<SyntaxKind>? validModifiers = null, 325ISet<SyntaxKind>? validTypeDeclarations = null, 332public bool IsRecordDeclarationContext(ISet<SyntaxKind> validModifiers, CancellationToken cancellationToken) 336if (!previousToken.IsKind(SyntaxKind.RecordKeyword)) 346ISet<SyntaxKind> validTypeDeclarations, bool includingRecordParameters, CancellationToken cancellationToken) 352if (token.Kind() == SyntaxKind.OpenBracketToken && 353token.Parent.IsKind(SyntaxKind.AttributeList)) 376if (token.Kind() == SyntaxKind.OpenBracketToken && 377token.Parent.IsKind(SyntaxKind.AttributeList) && 392if (token.Kind() == SyntaxKind.OpenBracketToken && 393token.Parent.IsKind(SyntaxKind.AttributeList) && 403ISet<SyntaxKind>? validModifiers = null, 404ISet<SyntaxKind>? validTypeDeclarations = null, 439if (targetToken.IsKind(SyntaxKind.AwaitKeyword)) 450&& targetToken.IsKind(SyntaxKind.IdentifierToken) 451&& targetToken.HasMatchingText(SyntaxKind.AwaitKeyword)) 483if (node.IsKind(SyntaxKind.QueryExpression)) 487if (targetToken.IsKind(SyntaxKind.InKeyword)) 534SyntaxKind.AssemblyKeyword or SyntaxKind.ModuleKeyword => AttributeTargets.Assembly | AttributeTargets.Module, 535SyntaxKind.TypeKeyword => AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, 536SyntaxKind.MethodKeyword => AttributeTargets.Method, 537SyntaxKind.FieldKeyword => AttributeTargets.Field, 538SyntaxKind.PropertyKeyword => AttributeTargets.Property, 539SyntaxKind.EventKeyword => AttributeTargets.Event, 540SyntaxKind.ParamKeyword => AttributeTargets.Parameter, 541SyntaxKind.ReturnKeyword => AttributeTargets.ReturnValue, 542SyntaxKind.TypeVarKeyword => AttributeTargets.GenericParameter, 555RecordDeclarationSyntax record => record.ClassOrStructKeyword.IsKind(SyntaxKind.StructKeyword)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTokenExtensions.cs (114)
19token.Kind() is SyntaxKind.UsingKeyword or 20SyntaxKind.ExternKeyword; 25if (token.IsKind(SyntaxKind.UsingKeyword)) 41if (token is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 47if (token.IsKind(SyntaxKind.UnsafeKeyword) && 48token.GetPreviousToken() is { RawKind: (int)SyntaxKind.StaticKeyword, Parent: UsingDirectiveSyntax }) 115case SyntaxKind.OpenBraceToken when token.Parent.IsKind(SyntaxKind.Block): 118case SyntaxKind.SemicolonToken: 120return statement != null && !statement.IsParentKind(SyntaxKind.GlobalStatement) && 123case SyntaxKind.CloseBraceToken: 124if (token.Parent.IsKind(SyntaxKind.Block)) 135if (token.Parent.Parent.Kind() is not SyntaxKind.TryStatement and not SyntaxKind.DoStatement) 139is SyntaxKind.ElseClause 140or SyntaxKind.FinallyClause 141or SyntaxKind.CatchClause 142or SyntaxKind.SwitchSection) 148if (token.Parent.IsKind(SyntaxKind.SwitchStatement)) 155case SyntaxKind.ColonToken: 156return token.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel or SyntaxKind.LabeledStatement); 158case SyntaxKind.DoKeyword when token.Parent.IsKind(SyntaxKind.DoStatement): 161case SyntaxKind.CloseParenToken: 164is SyntaxKind.ForStatement 165or SyntaxKind.ForEachStatement 166or SyntaxKind.ForEachVariableStatement 167or SyntaxKind.WhileStatement 168or SyntaxKind.IfStatement 169or SyntaxKind.LockStatement 170or SyntaxKind.UsingStatement 171or SyntaxKind.FixedStatement; 173case SyntaxKind.ElseKeyword: 174return token.Parent.IsKind(SyntaxKind.ElseClause); 176case SyntaxKind.CloseBracketToken: 177if (token.Parent.IsKind(SyntaxKind.AttributeList)) 207if (token.Kind() == SyntaxKind.CloseBraceToken) 211memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 217if (token.Kind() == SyntaxKind.SemicolonToken) 230memberDeclaration.IsParentKind(SyntaxKind.CompilationUnit)) 250if (token.Kind() == SyntaxKind.CloseBracketToken) 259if (token.Parent.IsKind(SyntaxKind.AttributeList)) 272if (token.Kind() == SyntaxKind.CloseParenToken) 274if (token.Parent.IsKind(SyntaxKind.CastExpression)) 300if (token.Kind() == SyntaxKind.IdentifierToken && 301token.GetPreviousToken(includeSkipped: true).Kind() == SyntaxKind.IntoKeyword) 326if (targetToken.Kind() is SyntaxKind.IfKeyword or 327SyntaxKind.ElifKeyword) 333if (targetToken.Kind() == SyntaxKind.OpenParenToken && 334targetToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 363if (targetToken.Kind() is not (SyntaxKind.IdentifierToken or SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken)) 395if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 396targetToken.Parent.IsKind(SyntaxKind.SwitchStatement)) 401if (targetToken.Kind() == SyntaxKind.ColonToken) 403if (targetToken.Parent is (kind: SyntaxKind.CaseSwitchLabel or SyntaxKind.DefaultSwitchLabel or SyntaxKind.CasePatternSwitchLabel)) 409if (targetToken.Kind() is SyntaxKind.SemicolonToken or 410SyntaxKind.CloseBraceToken) 430return targetToken.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken && 431targetToken.Parent is (kind: SyntaxKind.CrefBracketedParameterList or SyntaxKind.CrefParameterList); 449if (targetToken.Kind() == SyntaxKind.ColonToken && 450targetToken.Parent.IsKind(SyntaxKind.NameColon) && 451targetToken.Parent.Parent.IsKind(SyntaxKind.Argument) && 452targetToken.Parent.Parent.Parent.IsKind(SyntaxKind.ArgumentList)) 456is SyntaxKind.InvocationExpression 457or SyntaxKind.ObjectCreationExpression 458or SyntaxKind.BaseConstructorInitializer 459or SyntaxKind.ThisConstructorInitializer) 465if (targetToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 467if (targetToken.Parent.IsKind(SyntaxKind.ArgumentList)) 470is SyntaxKind.ObjectCreationExpression 471or SyntaxKind.BaseConstructorInitializer 472or SyntaxKind.ThisConstructorInitializer) 480if (targetToken.Parent.IsParentKind(SyntaxKind.InvocationExpression) && !targetToken.IsInvocationOfVarExpression()) 492if (targetToken.Kind() == SyntaxKind.OperatorKeyword && 504targetToken.GetAncestors<StatementSyntax>().Any(s => s.IsKind(SyntaxKind.UnsafeStatement)) || 505targetToken.GetAncestors<MemberDeclarationSyntax>().Any(m => m.GetModifiers().Any(SyntaxKind.UnsafeKeyword) || 506targetToken.GetAncestors<LocalFunctionStatementSyntax>().Any(f => f.GetModifiers().Any(SyntaxKind.UnsafeKeyword))) || 507targetToken.GetAncestors<UsingDirectiveSyntax>().Any(d => d.UnsafeKeyword.IsKind(SyntaxKind.UnsafeKeyword)); 515return targetToken.IsKindOrHasMatchingText(SyntaxKind.YieldKeyword); 518public static bool IsAnyAccessorDeclarationContext(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 525public static bool IsAccessorDeclarationContext<TMemberNode>(this SyntaxToken targetToken, int position, SyntaxKind kind = SyntaxKind.None) 545if (existingAccessor.Kind() != SyntaxKind.None) 569while (targetToken.Kind() is SyntaxKind.InternalKeyword or 570SyntaxKind.PublicKeyword or 571SyntaxKind.ProtectedKeyword or 572SyntaxKind.PrivateKeyword or 573SyntaxKind.ReadOnlyKeyword) 580if (targetToken.Kind() == SyntaxKind.OpenBraceToken && 581targetToken.Parent.IsKind(SyntaxKind.AccessorList)) 588if (targetToken.Kind() == SyntaxKind.CloseBraceToken && 589targetToken.Parent.IsKind(SyntaxKind.Block) && 596if (targetToken.Kind() == SyntaxKind.SemicolonToken && 603if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 604targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 615if (node.IsKind(SyntaxKind.TypeParameterList)) 617if (node?.Parent is TypeDeclarationSyntax(SyntaxKind.InterfaceDeclaration) typeDecl) 636if (targetToken.Kind() == SyntaxKind.LessThanToken && 642if (targetToken.Kind() == SyntaxKind.CommaToken && 648if (targetToken.Kind() == SyntaxKind.CloseBracketToken && 649targetToken.Parent.IsKind(SyntaxKind.AttributeList) && 650targetToken.Parent.Parent.IsKind(SyntaxKind.TypeParameter) && 661if (token.Kind() == SyntaxKind.CommaToken && token.Parent is BaseArgumentListSyntax)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ContextQuery\SyntaxTreeExtensions.cs (444)
21private static readonly ISet<SyntaxKind> s_validLocalFunctionModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 23SyntaxKind.ExternKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.AsyncKeyword, 26SyntaxKind.UnsafeKeyword, 36if (token.IsKind(SyntaxKind.OpenBracketToken) && 37token.Parent.IsKind(SyntaxKind.AttributeList)) 44if (token.IsKind(SyntaxKind.CommaToken) && 45token.Parent.IsKind(SyntaxKind.AttributeList)) 52if (token.IsKind(SyntaxKind.ColonToken) && 53token.Parent.IsKind(SyntaxKind.AttributeTargetSpecifier)) 60if (token.Parent.IsKind(SyntaxKind.QualifiedName) && 61token.Parent.IsParentKind(SyntaxKind.Attribute)) 68if (token.Parent.IsKind(SyntaxKind.AliasQualifiedName) && 69token.Parent.IsParentKind(SyntaxKind.Attribute)) 80ISet<SyntaxKind> validModifiers, 95if (token.IsKind(SyntaxKind.CloseBracketToken) 115if (parent.IsKind(SyntaxKind.CompilationUnit) || 116(parent is MemberDeclarationSyntax && parent.IsParentKind(SyntaxKind.CompilationUnit))) 129return kind is ((int)SyntaxKind.AssemblyKeyword) 130or ((int)SyntaxKind.ModuleKeyword); 166if (token.IsKind(SyntaxKind.OpenBraceToken)) 177if (token.IsKind(SyntaxKind.SemicolonToken)) 194if (token.IsKind(SyntaxKind.CloseBraceToken)) 208token.Parent.IsKind(SyntaxKind.Block) && 220if (token.IsKind(SyntaxKind.CloseBracketToken) && 221token.Parent.IsKind(SyntaxKind.AttributeList)) 243ISet<SyntaxKind>? validModifiers, 244ISet<SyntaxKind>? validTypeDeclarations, 257validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 285token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 294validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 299if (token.HasMatchingText(SyntaxKind.AsyncKeyword)) 322SyntaxKind otherModifier, 330return modifierTokens.Contains(otherModifier) && IsLambdaDeclarationContext(syntaxTree, position, SyntaxKind.None, cancellationToken); 342ISet<SyntaxKind> validModifiers, 359if (token.Kind() == SyntaxKind.CloseBracketToken && token.Parent is AttributeListSyntax) 420(nextToken.Kind() == SyntaxKind.GlobalKeyword && nextToken.GetAncestor<UsingDirectiveSyntax>()?.GlobalKeyword == nextToken)) 426if (token.IsKind(SyntaxKind.None)) 440if (token.IsKind(SyntaxKind.OpenBraceToken) && token.Parent is NamespaceDeclarationSyntax or TypeDeclarationSyntax) 455if (token.IsKind(SyntaxKind.SemicolonToken)) 457if (token.Parent is (kind: SyntaxKind.ExternAliasDirective or SyntaxKind.UsingDirective)) 477if (token.IsKind(SyntaxKind.CloseBraceToken)) 483else if (token.Parent.IsKind(SyntaxKind.NamespaceDeclaration)) 492token.Parent.IsKind(SyntaxKind.Block) && 507if (token.IsKind(SyntaxKind.CloseBracketToken) && 508token.Parent.IsKind(SyntaxKind.AttributeList)) 511if (token.Parent.IsParentKind(SyntaxKind.CompilationUnit)) 532ISet<SyntaxKind>? validModifiers, 533ISet<SyntaxKind>? validTypeDeclarations, 543validTypeDeclarations ??= SpecializedCollections.EmptySet<SyntaxKind>(); 576token.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) 591validModifiers ??= SpecializedCollections.EmptySet<SyntaxKind>(); 602return incompleteMember.Type.IsKind(SyntaxKind.RefType); 609if (modifierTokens.Contains(SyntaxKind.FileKeyword)) 612if (modifierTokens.Contains(SyntaxKind.ClosedKeyword)) 638if (token.IsKind(SyntaxKind.ColonColonToken) && 639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.GlobalKeyword)) 651if (token.IsKind(SyntaxKind.UsingKeyword)) 656if (token.GetNextToken(includeSkipped: true).Kind() != SyntaxKind.EqualsToken && 701is SyntaxKind.ClassKeyword 702or SyntaxKind.StructKeyword 703or SyntaxKind.InterfaceKeyword && 704token.GetPreviousToken().IsKind(SyntaxKind.PartialKeyword)) 737syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || 738syntaxTree.IsAfterKeyword(position, SyntaxKind.RefKeyword, cancellationToken) || 739syntaxTree.IsAfterKeyword(position, SyntaxKind.ReadOnlyKeyword, cancellationToken) || 740syntaxTree.IsAfterKeyword(position, SyntaxKind.CaseKeyword, cancellationToken) || 741syntaxTree.IsAfterKeyword(position, SyntaxKind.EventKeyword, cancellationToken) || 742syntaxTree.IsAfterKeyword(position, SyntaxKind.StackAllocKeyword, cancellationToken) || 785if (token.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken && 801if (token.IsKind(SyntaxKind.EqualsToken) && 831if (token.IsKind(SyntaxKind.WhereKeyword) && 832token.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause)) 837if (token.IsKind(SyntaxKind.IdentifierToken) && 838token.HasMatchingText(SyntaxKind.WhereKeyword) && 839token.Parent.IsKind(SyntaxKind.IdentifierName) && 840token.Parent.IsParentKind(SyntaxKind.SimpleBaseType) && 841token.Parent.Parent.IsParentKind(SyntaxKind.BaseList)) 858if (token.IsKind(SyntaxKind.ColonToken) && 859token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IdentifierToken) && 860token.GetPreviousToken(includeSkipped: true).GetPreviousToken().IsKind(SyntaxKind.WhereKeyword)) 884if (token.IsKind(SyntaxKind.CommaToken) && 903if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.TypeOfExpression)) 915if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.DefaultExpression)) 928if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.SizeOfExpression)) 947case SyntaxKind.LessThanToken: 948case SyntaxKind.CommaToken: 949return token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList); 955{ Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } => true, 957{ Parent: TypeSyntax { Parent.RawKind: (int)SyntaxKind.FunctionPointerParameter } } => true, 963=> targetToken.Parent.IsKind(SyntaxKind.TypeParameterConstraintClause) && 964targetToken.Kind() is SyntaxKind.ColonToken or SyntaxKind.CommaToken; 980if (token.Kind() is not SyntaxKind.LessThanToken and not SyntaxKind.CommaToken) 1015if (name.IsParentKind(SyntaxKind.LessThanExpression) && 1017conditional.IsParentKind(SyntaxKind.ExpressionStatement) && 1018conditional.Parent.IsParentKind(SyntaxKind.GlobalStatement)) 1060out SyntaxKind previousModifier) 1069previousModifier = SyntaxKind.None; 1071if (token.IsKind(SyntaxKind.OpenParenToken) && 1079if (token.IsKind(SyntaxKind.LessThanToken) && token.Parent.IsKind(SyntaxKind.FunctionPointerParameterList)) 1085if (token.IsKind(SyntaxKind.CommaToken) && 1095if (token.IsKind(SyntaxKind.CommaToken) && 1104if (token.IsKind(SyntaxKind.CloseBracketToken) && 1105token.Parent.IsKind(SyntaxKind.AttributeList) && 1115if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.ReadOnlyKeyword or SyntaxKind.OutKeyword or SyntaxKind.ThisKeyword or SyntaxKind.ParamsKeyword or SyntaxKind.ScopedKeyword) 1120else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName }) 1123previousModifier = SyntaxKind.ScopedKeyword; 1150if (syntaxTree.IsParameterModifierContext(position, tokenOnLeftOfPosition, includeOperators: false, out _, out var previousModifier) && 1151previousModifier == SyntaxKind.None) 1164if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken) 1166return token.Parent.IsKind(SyntaxKind.BracketedParameterList); 1178if (token.IsKind(SyntaxKind.DelegateKeyword) && 1179token.Parent.IsKind(SyntaxKind.DelegateDeclaration)) 1193if (token.IsKind(SyntaxKind.OperatorKeyword) && 1194token.GetPreviousToken(includeSkipped: true).Kind() is SyntaxKind.ImplicitKeyword or SyntaxKind.ExplicitKeyword) 1210if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 1211token.Parent is (kind: SyntaxKind.ParameterList or SyntaxKind.BracketedParameterList)) 1225typeDecl.IsKind(SyntaxKind.ClassDeclaration) && 1226method.Modifiers.Any(SyntaxKind.StaticKeyword) && 1227typeDecl.Modifiers.Any(SyntaxKind.StaticKeyword); 1236if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1238if (token.Parent.IsKind(SyntaxKind.ParameterList) && 1239token.Parent.IsParentKind(SyntaxKind.ParenthesizedLambdaExpression)) 1255if (token.Parent is (kind: SyntaxKind.ParenthesizedExpression or SyntaxKind.TupleExpression or SyntaxKind.CastExpression)) 1269if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1273else if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent.IsKind(SyntaxKind.Parameter)) 1277else if (token.IsKind(SyntaxKind.IdentifierToken) && token is { Text: "scoped", Parent: IdentifierNameSyntax scopedIdentifierName } && scopedIdentifierName.Parent.IsKind(SyntaxKind.Parameter)) 1286return parent.IsKind(SyntaxKind.ParameterList) && parent.IsParentKind(SyntaxKind.AnonymousMethodExpression); 1295if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 1328if (leftToken.IsKind(SyntaxKind.CloseParenToken)) 1331SyntaxKind.ParenthesizedExpression or 1332SyntaxKind.TupleExpression or 1333SyntaxKind.TupleType)) 1345if (leftToken.IsKind(SyntaxKind.IdentifierToken)) 1356if (leftToken.IsKind(SyntaxKind.IdentifierToken) && 1357leftToken.Parent.IsKind(SyntaxKind.IdentifierName) && 1358leftToken.Parent.Parent is (kind: SyntaxKind.QualifiedName or SyntaxKind.SimpleMemberAccessExpression)) 1374if (leftToken.IsKind(SyntaxKind.OpenParenToken)) 1384if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedPattern)) 1392if (leftToken.Kind() is SyntaxKind.CaseKeyword or SyntaxKind.IsKeyword) 1399if (leftToken.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.SwitchExpression)) 1406if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.PositionalPatternClause)) 1413if (leftToken.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.ListPattern)) 1420if (leftToken.IsKind(SyntaxKind.DotDotToken) && leftToken.Parent.IsKind(SyntaxKind.SlicePattern)) 1428if (leftToken.IsKind(SyntaxKind.ColonToken) && leftToken.Parent is (kind: SyntaxKind.NameColon or SyntaxKind.ExpressionColon) && 1429leftToken.Parent.IsParentKind(SyntaxKind.Subpattern)) 1439if (leftToken.IsKindOrHasMatchingText(SyntaxKind.AndKeyword) || leftToken.IsKindOrHasMatchingText(SyntaxKind.OrKeyword)) 1446if (leftToken.IsKind(SyntaxKind.NotKeyword) && leftToken.Parent.IsKind(SyntaxKind.NotPattern)) 1455if (leftToken.Kind() is SyntaxKind.GreaterThanToken or SyntaxKind.GreaterThanEqualsToken or SyntaxKind.LessThanToken or SyntaxKind.LessThanEqualsToken && 1456leftToken.Parent.IsKind(SyntaxKind.RelationalPattern)) 1472if (leftToken.IsKind(SyntaxKind.DotToken) || 1473leftToken.IsKind(SyntaxKind.MinusGreaterThanToken)) 1492return leftToken.Kind() is not (SyntaxKind.OrKeyword 1493or SyntaxKind.AndKeyword 1494or SyntaxKind.NotKeyword 1495or SyntaxKind.OpenParenToken 1496or SyntaxKind.ColonColonToken 1497or SyntaxKind.DotDotToken 1498or SyntaxKind.OpenBraceToken); 1534binaryExpressionSyntax.OperatorToken.IsKind(SyntaxKind.IsKeyword) && 1576if (possibleCommaOrParen.Kind() is not (SyntaxKind.OpenParenToken or SyntaxKind.CommaToken)) 1582SyntaxKind.ParenthesizedExpression or 1583SyntaxKind.TupleExpression or 1584SyntaxKind.TupleType or 1585SyntaxKind.CastExpression)) 1591if (possibleCommaOrParen.Parent.IsKind(SyntaxKind.ParameterList) && 1616if (leftToken.Parent.IsKind(SyntaxKind.ParenthesizedVariableDesignation) || 1617leftToken.Parent.IsParentKind(SyntaxKind.ParenthesizedVariableDesignation)) 1637if (leftToken.IsKind(SyntaxKind.OpenParenToken) && leftToken.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1647if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && leftToken.Parent.IsKind(SyntaxKind.TupleExpression)) 1657if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 1681if (node.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 1687if (node.Parent.IsKind(SyntaxKind.Argument) && node.Parent.Parent.IsKind(SyntaxKind.TupleExpression)) 1699if (leftToken.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 1700leftToken.Parent.IsKind(SyntaxKind.ArgumentList) && 1793if (token.IsKind(SyntaxKind.ConstKeyword) && 1794token.Parent.IsKind(SyntaxKind.LocalDeclarationStatement)) 1803if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.ReadOnlyKeyword) 1806if (parent is (kind: SyntaxKind.RefType or SyntaxKind.RefExpression or SyntaxKind.LocalDeclarationStatement)) 1808if (parent.IsParentKind(SyntaxKind.VariableDeclaration) && 1810SyntaxKind.LocalDeclarationStatement or 1811SyntaxKind.ForStatement or 1812SyntaxKind.ForEachVariableStatement)) 1817if (parent.Parent is (kind: SyntaxKind.ForEachStatement or SyntaxKind.ForEachVariableStatement)) 1825if (token.IsKind(SyntaxKind.OutKeyword) && 1837if (token.IsKind(SyntaxKind.OpenParenToken)) 1840if (previous.Kind() is SyntaxKind.ForKeyword or SyntaxKind.ForEachKeyword or SyntaxKind.UsingKeyword) 1846if (token.IsKind(SyntaxKind.UsingKeyword) && 1854if (token.IsKindOrHasMatchingText(SyntaxKind.FromKeyword) && 1861if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.JoinKeyword) && 1873if (token.IsKind(SyntaxKind.IdentifierToken) && token.Text == "scoped" && token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.Parent is VariableDeclarationSyntax or ExpressionStatementSyntax or IncompleteMemberSyntax) 1879if (token.IsKind(SyntaxKind.ScopedKeyword) && token.Parent is IncompleteMemberSyntax or ScopedTypeSyntax) 1896if (token.IsKind(SyntaxKind.OpenParenToken) && 1897token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.FixedKeyword)) 1913if (token.IsKind(SyntaxKind.OpenParenToken) && 1914token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CatchKeyword)) 1927if (token.Kind() is SyntaxKind.IsKeyword or SyntaxKind.AsKeyword) 1938if (token.IsKind(SyntaxKind.NewKeyword)) 1992if (token.IsKind(SyntaxKind.None)) 2042if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.OpenParenToken) && 2056if (token.IsKind(SyntaxKind.OpenParenToken) && 2057token.Parent.IsKind(SyntaxKind.CastExpression)) 2076if (token.IsKind(SyntaxKind.CaseKeyword) && 2077token.Parent.IsKind(SyntaxKind.GotoCaseStatement)) 2082if (token.IsKind(SyntaxKind.EqualsToken) && 2085if (equalsValue.IsParentKind(SyntaxKind.VariableDeclarator) && 2086equalsValue.Parent.IsParentKind(SyntaxKind.VariableDeclaration)) 2092return fieldDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2099return localDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); 2104if (equalsValue.IsParentKind(SyntaxKind.EnumMemberDeclaration)) 2110if (equalsValue.IsParentKind(SyntaxKind.Parameter)) 2118if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList) && 2119token.Kind() is SyntaxKind.CommaToken or SyntaxKind.OpenParenToken) 2125if (token.IsKind(SyntaxKind.ColonToken) && 2126token.Parent.IsKind(SyntaxKind.NameColon) && 2127token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2133if (token.IsKind(SyntaxKind.EqualsToken) && 2134token.Parent.IsKind(SyntaxKind.NameEquals) && 2135token.Parent.IsParentKind(SyntaxKind.AttributeArgument)) 2205is SyntaxKind.DotToken 2206or SyntaxKind.ColonColonToken 2207or SyntaxKind.MinusGreaterThanToken) 2214if (token.IsKind(SyntaxKind.EqualsToken)) 2216if (token.Parent.IsKind(SyntaxKind.NameEquals) && 2217token.Parent.IsParentKind(SyntaxKind.UsingDirective)) 2237is SyntaxKind.EqualsToken 2238or SyntaxKind.MinusEqualsToken 2239or SyntaxKind.AsteriskEqualsToken 2240or SyntaxKind.PlusEqualsToken 2241or SyntaxKind.SlashEqualsToken 2242or SyntaxKind.ExclamationEqualsToken 2243or SyntaxKind.CaretEqualsToken 2244or SyntaxKind.AmpersandEqualsToken 2245or SyntaxKind.BarEqualsToken 2246or SyntaxKind.PercentEqualsToken 2247or SyntaxKind.LessThanLessThanEqualsToken 2248or SyntaxKind.GreaterThanGreaterThanEqualsToken 2249or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken 2250or SyntaxKind.QuestionQuestionEqualsToken) 2256if (token.IsKind(SyntaxKind.OpenParenToken)) 2258if (token.Parent.IsKind(SyntaxKind.ParenthesizedExpression)) 2331if (token.IsKind(SyntaxKind.AsteriskToken) && semanticModel != null) 2348tokenOnLeftOfPosition.IsKind(SyntaxKind.IdentifierToken)) 2351if (previousToken.Kind() is SyntaxKind.AsteriskToken or SyntaxKind.QuestionToken && 2352previousToken.Parent?.Kind() is SyntaxKind.PointerType or SyntaxKind.NullableType) 2355if (type.IsParentKind(SyntaxKind.VariableDeclaration) && 2374if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2375token.Parent.IsKind(SyntaxKind.ArrayRankSpecifier)) 2382if (token.IsKind(SyntaxKind.DotDotToken) && 2383token.Parent.IsKind(SyntaxKind.RangeExpression) && 2390if (token.IsKind(SyntaxKind.QuestionToken) && 2399if (token.IsKind(SyntaxKind.ColonToken) && 2400token.Parent.IsKind(SyntaxKind.ConditionalExpression)) 2408if (token.IsKind(SyntaxKind.OpenParenToken)) 2410if (token.Parent is (kind: SyntaxKind.TypeOfExpression or SyntaxKind.DefaultExpression or SyntaxKind.SizeOfExpression)) 2419if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken && 2430if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2431token.Parent is (kind: SyntaxKind.ArgumentList or SyntaxKind.BracketedArgumentList or SyntaxKind.TupleExpression)) 2440if (token.Kind() is SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 2442if (token.Parent.IsKind(SyntaxKind.AttributeArgumentList)) 2453if (token.Kind() is SyntaxKind.RefKeyword or SyntaxKind.InKeyword or SyntaxKind.OutKeyword) 2455if (token.Parent.IsKind(SyntaxKind.Argument)) 2459else if (token.Parent.IsKind(SyntaxKind.RefExpression)) 2463if (token.Parent.IsParentKind(SyntaxKind.ParenthesizedExpression)) 2473if (token.IsKind(SyntaxKind.ColonToken) && 2474token.Parent.IsKind(SyntaxKind.NameColon) && 2475token.Parent.IsParentKind(SyntaxKind.Argument)) 2481if (token.IsKind(SyntaxKind.EqualsGreaterThanToken)) 2488if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2494if (token.Parent.IsKind(SyntaxKind.ObjectInitializerExpression) && token.IsKind(SyntaxKind.OpenBraceToken)) 2497if (!token.IntersectsWith(position) && token.GetNextToken().GetNextToken().IsKind(SyntaxKind.EqualsToken)) 2524if (token.IsKind(SyntaxKind.SemicolonToken) && 2535if (token.IsKind(SyntaxKind.OpenParenToken) && 2544if (token.IsKind(SyntaxKind.CommaToken) && 2545token.Parent.IsKind(SyntaxKind.ForStatement)) 2554if (token.IsKind(SyntaxKind.InKeyword)) 2557SyntaxKind.ForEachStatement or 2558SyntaxKind.ForEachVariableStatement or 2559SyntaxKind.FromClause or 2560SyntaxKind.JoinClause)) 2568if (token.Kind() is SyntaxKind.OnKeyword or SyntaxKind.EqualsKeyword && 2569token.Parent.IsKind(SyntaxKind.JoinClause)) 2575if (token.IsKind(SyntaxKind.WhereKeyword) && 2576token.Parent.IsKind(SyntaxKind.WhereClause)) 2583if (token.Kind() is SyntaxKind.OrderByKeyword or SyntaxKind.CommaToken && 2584token.Parent.IsKind(SyntaxKind.OrderByClause)) 2590if (token.IsKind(SyntaxKind.SelectKeyword) && 2591token.Parent.IsKind(SyntaxKind.SelectClause)) 2598if (token.Kind() is SyntaxKind.GroupKeyword or SyntaxKind.ByKeyword && 2599token.Parent.IsKind(SyntaxKind.GroupClause)) 2607if (token.IsKind(SyntaxKind.ReturnKeyword)) 2609if (token.GetPreviousToken(includeSkipped: true).Kind() != SyntaxKind.OpenBracketToken) 2616if (token.IsKind(SyntaxKind.ThrowKeyword)) 2622if (token.IsKind(SyntaxKind.OpenParenToken) && 2623token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhileKeyword)) 2632if (token.IsKind(SyntaxKind.OpenParenToken) && token.Parent.IsKind(SyntaxKind.UsingStatement)) 2638if (token.IsKind(SyntaxKind.OpenParenToken) && 2639token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.LockKeyword)) 2645if (token.IsKind(SyntaxKind.OpenParenToken) && 2646token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.IfKeyword)) 2652if (token.IsKind(SyntaxKind.OpenParenToken) && 2653token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.SwitchKeyword)) 2659if (token.IsKind(SyntaxKind.OpenParenToken) && 2660token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.CheckedKeyword)) 2666if (token.IsKind(SyntaxKind.OpenParenToken) && 2667token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.UncheckedKeyword)) 2673if (token.IsKind(SyntaxKind.OpenParenToken) && 2674token.GetPreviousToken(includeSkipped: true).IsKind(SyntaxKind.WhenKeyword)) 2680if (token.IsKind(SyntaxKind.WhenKeyword) && token.Parent.IsKind(SyntaxKind.WhenClause)) 2697if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken && 2698token.Parent.IsKind(SyntaxKind.AnonymousObjectCreationExpression)) 2706if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.CommaToken && 2707token.Parent.IsKind(SyntaxKind.ListPattern)) 2715if (token.Kind() is SyntaxKind.OpenBracketToken or SyntaxKind.DotDotToken or SyntaxKind.CommaToken && 2716token.Parent.IsKind(SyntaxKind.CollectionExpression)) 2724if (token.Kind() is SyntaxKind.DotDotToken && 2725token.Parent.IsKind(SyntaxKind.SpreadElement)) 2736if (token.IsKind(SyntaxKind.OpenBraceToken)) 2757if (token.IsKind(SyntaxKind.DotToken)) 2760if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2763while (parentMemberAccess.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 2768if (parentMemberAccess.Parent.IsKind(SyntaxKind.Argument) && 2776if (token.Parent.IsKind(SyntaxKind.QualifiedName)) 2779while (parentQualifiedName.Parent.IsKind(SyntaxKind.QualifiedName)) 2784if (parentQualifiedName.Parent.IsKind(SyntaxKind.Argument) && 2795if (token.Parent.IsKind(SyntaxKind.ArgumentList) && 2829if (token.IsKind(SyntaxKind.NumericLiteralToken)) 2859if (type.Kind() is SyntaxKind.GenericName or SyntaxKind.AliasQualifiedName or SyntaxKind.PredefinedType) 2874if (token.IsKind(SyntaxKind.IdentifierToken) && 2875token.Parent.IsKind(SyntaxKind.IdentifierName) && 2876token.Parent.Parent is (kind: SyntaxKind.ObjectInitializerExpression or SyntaxKind.CollectionInitializerExpression)) 2882if (token.Kind() is SyntaxKind.IdentifierToken && 2883token.Parent.IsKind(SyntaxKind.IdentifierName)) 2885if (token.Parent.Parent is ArgumentSyntax { RefOrOutKeyword.RawKind: (int)SyntaxKind.OutKeyword }) 2889if (token.Text == SyntaxFacts.GetText(SyntaxKind.AsyncKeyword)) 2907if (tokenBeforeName.Kind() == SyntaxKind.CaseKeyword) 2925case SyntaxKind.QualifiedName: 2927case SyntaxKind.AliasQualifiedName: 2929case SyntaxKind.SimpleMemberAccessExpression: 2958if (token.IsKind(SyntaxKind.CloseBraceToken)) 2964block.Parent?.Kind() is SyntaxKind.TryStatement or SyntaxKind.CatchClause) 2984if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CatchKeyword)) 2989if (CodeAnalysis.CSharpExtensions.IsKind(token, SyntaxKind.CloseParenToken) && 2990token.Parent.IsKind(SyntaxKind.CatchDeclaration)) 3007targetToken is (kind: SyntaxKind.ColonToken or SyntaxKind.CommaToken) && 3018targetToken.IsKind(SyntaxKind.ColonToken) && 3019targetToken.Parent.IsKind(SyntaxKind.BaseList) && 3020targetToken.Parent.IsParentKind(SyntaxKind.EnumDeclaration); 3029if (!token.IsKind(SyntaxKind.DotToken)) 3035if (token.Parent.IsKind(SyntaxKind.SimpleMemberAccessExpression)) 3041token.Parent?.Parent is BinaryExpressionSyntax(SyntaxKind.IsExpression) binaryExpression && 3080return targetToken.IsKind(SyntaxKind.AsteriskToken) && 3081targetToken.GetPreviousToken().IsKind(SyntaxKind.DelegateKeyword);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ExpressionSyntaxExtensions.cs (6)
30if (expression.IsKind(SyntaxKind.RefExpression)) 42if (expression.IsKind(SyntaxKind.ThrowExpression)) 58Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 60Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty)); 72Token(SyntaxTriviaList.Empty, SyntaxKind.OpenParenToken, SyntaxTriviaList.Empty), 74Token(SyntaxTriviaList.Empty, SyntaxKind.CloseParenToken, SyntaxTriviaList.Empty));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeParameterSymbolExtensions.cs (2)
43constraints.Add(ClassOrStructConstraint(SyntaxKind.ClassConstraint)); 51constraints.Add(ClassOrStructConstraint(SyntaxKind.StructConstraint));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.cs (1)
97if (reference.GetSyntax().ChildTokens().Any(t => t.IsKind(SyntaxKind.UnsafeKeyword)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.ExpressionSyntaxGeneratorVisitor.cs (1)
111SyntaxKind.SimpleMemberAccessExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\NameSyntaxExtensions.cs (4)
36is SyntaxKind.AliasQualifiedName 37or SyntaxKind.NameColon 38or SyntaxKind.NameEquals 39or SyntaxKind.TypeParameterConstraintClause)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SeparatedSyntaxListExtensions.cs (4)
12this SeparatedSyntaxList<T> separatedList, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken) 19this SeparatedSyntaxList<T> separatedList, int index, IEnumerable<T> nodes, SyntaxKind separator = SyntaxKind.CommaToken)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\StringExtensions.cs (2)
23var needsEscaping = SyntaxFacts.GetKeywordKind(identifier) != SyntaxKind.None; 47default, SyntaxKind.None, "@" + unescaped, unescaped, default);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTokenListExtensions.cs (1)
12public static IEnumerable<SyntaxToken> SkipKinds(this SyntaxTokenList tokenList, params SyntaxKind[] kinds)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTreeExtensions.cs (17)
58if (token.Kind() == SyntaxKind.None) 74case SyntaxKind.LessThanToken: 81if (token.Kind() == SyntaxKind.None) 92if (token.Kind() == SyntaxKind.IdentifierToken) 113case SyntaxKind.GreaterThanToken: 114case SyntaxKind.GreaterThanGreaterThanToken: 115case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 127case SyntaxKind.AsteriskToken: // for int* 128case SyntaxKind.QuestionToken: // for int? 129case SyntaxKind.ColonToken: // for global:: (so we don't dismiss help as you type the first :) 130case SyntaxKind.ColonColonToken: // for global:: 131case SyntaxKind.CloseBracketToken: 132case SyntaxKind.OpenBracketToken: 133case SyntaxKind.DotToken: 134case SyntaxKind.IdentifierToken: 137case SyntaxKind.CommaToken: 162if (token.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (6)
74if (typeNode.Modifiers.Any(SyntaxKind.PartialKeyword)) 97private static SyntaxToken EnsureToken(SyntaxToken token, SyntaxKind kind, bool prependNewLineIfMissing = false, bool appendNewLineIfMissing = false) 99if (token.IsMissing || token.IsKind(SyntaxKind.None)) 111var openBrace = EnsureToken(typeDeclaration.OpenBraceToken, SyntaxKind.OpenBraceToken); 112var closeBrace = EnsureToken(typeDeclaration.CloseBraceToken, SyntaxKind.CloseBraceToken, appendNewLineIfMissing: true); 117if (addedBraces && typeDeclaration.SemicolonToken.IsKind(SyntaxKind.SemicolonToken))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\CSharpSyntaxFormattingService.cs (26)
50token.Kind() is SyntaxKind.EndOfFileToken or SyntaxKind.None || 58if (token.IsKind(SyntaxKind.CloseParenToken) && !token.Parent.IsKind(SyntaxKind.UsingStatement)) 63if (token.IsKind(SyntaxKind.ColonToken) && !token.Parent.IsKind(SyntaxKind.LabeledStatement) && token.Parent is not SwitchLabelSyntax) 67if (token.IsKind(SyntaxKind.OpenBraceToken) && !token.IsFirstTokenOnLine(documentSyntax.Text)) 129(token.IsKind(SyntaxKind.CloseBraceToken) && OnlySmartIndentCloseBrace(indentationOptions.AutoFormattingOptions)) || 130(token.IsKind(SyntaxKind.OpenBraceToken) && OnlySmartIndentOpenBrace(indentationOptions.AutoFormattingOptions)); 151if (token.Kind() != SyntaxKind.ElseKeyword || 199if (endToken.IsKind(SyntaxKind.OpenBraceToken)) 289if (tokenBeforeCaret.Kind() is SyntaxKind.CloseBraceToken or 290SyntaxKind.EndOfFileToken) 301internal static bool ValidSingleOrMultiCharactersTokenKind(char typedChar, SyntaxKind kind) 304'n' => kind is SyntaxKind.RegionKeyword or SyntaxKind.EndRegionKeyword, 305't' => kind is SyntaxKind.SelectKeyword, 306'e' => kind is SyntaxKind.WhereKeyword or SyntaxKind.ElseKeyword, 317is SyntaxKind.None 318or SyntaxKind.EndOfDirectiveToken 319or SyntaxKind.EndOfFileToken; 354if (currentToken.Kind() == SyntaxKind.OpenBraceToken && 356currentTokenParentParent.Kind() is SyntaxKind.SimpleLambdaExpression or SyntaxKind.ParenthesizedLambdaExpression or SyntaxKind.AnonymousMethodExpression)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Formatting\TypingFormattingRule.cs (1)
104while (node != null && node.Kind() != SyntaxKind.CompilationUnit)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (8)
79if (token.IsKind(SyntaxKind.None) || 89if (previousToken.Kind() == SyntaxKind.None || previousToken.IsMissing) 109return token.Kind() is SyntaxKind.None or SyntaxKind.EndOfDirectiveToken or SyntaxKind.EndOfFileToken; 125node.IsKind(SyntaxKind.Interpolation)) 132!argument.Parent.IsKind(SyntaxKind.ThisConstructorInitializer) && 141constructorInitializer.ArgumentList.OpenParenToken.Kind() != SyntaxKind.None &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (22)
74Contract.ThrowIfTrue(token.Kind() == SyntaxKind.None); 81if (token.IsKind(SyntaxKind.MultiLineRawStringLiteralToken)) 120if (token.Kind() is SyntaxKind.InterpolatedMultiLineRawStringStartToken or SyntaxKind.InterpolatedStringTextToken 121|| token is { RawKind: (int)SyntaxKind.CloseBraceToken, Parent: InterpolationSyntax }) 125if (interpolatedExpression.StringStartToken.IsKind(SyntaxKind.InterpolatedMultiLineRawStringStartToken)) 139if (!indenter.Root.FindToken(currentLine.Start, findInsideTrivia: true).IsKind(SyntaxKind.InterpolatedStringTextToken)) 175token.Kind() is SyntaxKind.InterpolatedVerbatimStringStartToken or SyntaxKind.InterpolatedStringTextToken || 176(token.IsKind(SyntaxKind.CloseBraceToken) && token.Parent.IsKind(SyntaxKind.Interpolation))) 240case SyntaxKind.SemicolonToken: 251case SyntaxKind.CloseBraceToken: 253if (token.Parent.IsKind(SyntaxKind.AccessorList) && 254token.Parent.Parent.IsKind(SyntaxKind.PropertyDeclaration)) 265case SyntaxKind.OpenBraceToken: 270case SyntaxKind.ColonToken: 283case SyntaxKind.CloseBracketToken: 297case SyntaxKind.XmlTextLiteralToken: 302case SyntaxKind.CommaToken: 307case SyntaxKind.CloseParenToken: 309if (token.Parent.IsKind(SyntaxKind.ArgumentList))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpAddImportsService.cs (1)
103=> SyntaxFactory.AreEquivalent(a, b, kind => kind == SyntaxKind.NullableDirectiveTrivia);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
63(i == 0 && currentUsing.IsParentKind(SyntaxKind.FileScopedNamespaceDeclaration)))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (3)
78contextualKind: SyntaxKind.UnderscoreToken, 104kind: SyntaxKind.IsExpression, 251kind: SyntaxKind.SimpleAssignmentExpression,
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (2)
85if (braces.openBrace.Kind() == SyntaxKind.None && 86braces.closeBrace.Kind() == SyntaxKind.None)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (19)
67.WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)); 109=> SyntaxFactory.YieldStatement(SyntaxKind.YieldReturnStatement, (ExpressionSyntax)expression); 126SyntaxKind.InterpolatedStringTextToken, 139SyntaxFactory.Token(default, SyntaxKind.InterpolatedStringTextToken, format, format, default)); 216=> SyntaxFactory.BinaryPattern(SyntaxKind.AndPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 242=> SyntaxFactory.BinaryPattern(SyntaxKind.OrPattern, (PatternSyntax)ParenthesizeNonSimple(left), (PatternSyntax)ParenthesizeNonSimple(right)); 270return SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression); 276return SyntaxFactory.LiteralExpression(SyntaxKind.FalseLiteralExpression); 289SyntaxKind.NumericLiteralExpression, SyntaxFactory.Literal("0", 0)); 313SyntaxKind.SimpleMemberAccessExpression, 325is SyntaxKind.ThisExpression 326or SyntaxKind.BaseExpression 327or SyntaxKind.ParenthesizedExpression 328or SyntaxKind.SimpleMemberAccessExpression 329or SyntaxKind.InvocationExpression 330or SyntaxKind.ElementAccessExpression 331or SyntaxKind.MemberBindingExpression) 340=> CreateBinaryExpression(SyntaxKind.BitwiseOrExpression, left, right); 342public static SyntaxNode CreateBinaryExpression(SyntaxKind syntaxKind, SyntaxNode left, SyntaxNode right)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (81)
327if (argument.Parent.IsParentKind(SyntaxKind.ImplicitElementAccess) && 328argument.Parent.Parent.IsParentKind(SyntaxKind.SimpleAssignmentExpression) && 329argument.Parent.Parent.Parent.IsParentKind(SyntaxKind.ObjectInitializerExpression) && 350if (previousToken.IsKind(SyntaxKind.CommaToken)) 431if (previousToken.Kind() == SyntaxKind.NewKeyword && 432previousToken.GetPreviousToken().Kind() is SyntaxKind.EqualsToken or SyntaxKind.OpenParenToken or SyntaxKind.CommaToken) 518if (previousToken != argumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 548if (previousToken != attributeArgumentList.OpenParenToken && previousToken.Kind() != SyntaxKind.CommaToken) 822if (previousToken.HasValue && previousToken.Value.GetPreviousToken().Kind() == SyntaxKind.EqualsToken) 897if (previousToken != bracketedArgumentList.OpenBracketToken && previousToken.Kind() != SyntaxKind.CommaToken) 954if (binop.Kind() == SyntaxKind.CoalesceExpression) 962case SyntaxKind.LessThanLessThanToken: 963case SyntaxKind.GreaterThanGreaterThanToken: 964case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 965case SyntaxKind.LessThanLessThanEqualsToken: 966case SyntaxKind.GreaterThanGreaterThanEqualsToken: 967case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 979if (operatorToken.Kind() is SyntaxKind.AmpersandAmpersandToken or 980SyntaxKind.BarBarToken) 986if (binop.Kind() == SyntaxKind.SimpleAssignmentExpression && 1015if (operatorToken.Kind() is SyntaxKind.AmpersandToken or 1016SyntaxKind.AmpersandEqualsToken or 1017SyntaxKind.BarToken or 1018SyntaxKind.BarEqualsToken or 1019SyntaxKind.CaretToken or 1020SyntaxKind.CaretEqualsToken) 1031if (operatorToken.Kind() == SyntaxKind.PlusToken) 1046case SyntaxKind.BarToken: 1047case SyntaxKind.CaretToken: 1048case SyntaxKind.AmpersandToken: 1049case SyntaxKind.LessThanToken: 1050case SyntaxKind.LessThanEqualsToken: 1051case SyntaxKind.GreaterThanToken: 1052case SyntaxKind.GreaterThanEqualsToken: 1053case SyntaxKind.PlusToken: 1054case SyntaxKind.MinusToken: 1055case SyntaxKind.AsteriskToken: 1056case SyntaxKind.SlashToken: 1057case SyntaxKind.PercentToken: 1058case SyntaxKind.CaretEqualsToken: 1059case SyntaxKind.PlusEqualsToken: 1060case SyntaxKind.MinusEqualsToken: 1061case SyntaxKind.AsteriskEqualsToken: 1062case SyntaxKind.SlashEqualsToken: 1063case SyntaxKind.PercentEqualsToken: 1064case SyntaxKind.LessThanLessThanToken: 1065case SyntaxKind.GreaterThanGreaterThanToken: 1066case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: 1067case SyntaxKind.LessThanLessThanEqualsToken: 1068case SyntaxKind.GreaterThanGreaterThanEqualsToken: 1069case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: 1072case SyntaxKind.BarEqualsToken: 1073case SyntaxKind.AmpersandEqualsToken: 1224if (equalsValue.IsParentKind(SyntaxKind.Parameter) && 1381if (initializerExpression.IsKind(SyntaxKind.ComplexElementInitializerExpression)) 1401else if (initializerExpression.IsKind(SyntaxKind.CollectionInitializerExpression)) 1423foreach (var sibling in initializerExpression.Expressions.Where(e => e.Kind() != SyntaxKind.ComplexElementInitializerExpression)) 1492else if (initializerExpression.IsParentKind(SyntaxKind.SimpleAssignmentExpression)) 1582if (identifier.HasMatchingText(SyntaxKind.OrKeyword) || 1583identifier.HasMatchingText(SyntaxKind.AndKeyword)) 1703var isAsync = anonymousFunction.AsyncKeyword.Kind() != SyntaxKind.None; 1807memberAccessExpression.Parent.IsParentKind(SyntaxKind.AwaitExpression)) 1831if (ienumerableType != null && memberAccessExpression.IsParentKind(SyntaxKind.InvocationExpression, out invocation)) 1973case SyntaxKind.PostDecrementExpression: 1974case SyntaxKind.PostIncrementExpression: 1988case SyntaxKind.PreDecrementExpression: 1989case SyntaxKind.PreIncrementExpression: 1990case SyntaxKind.UnaryPlusExpression: 1991case SyntaxKind.UnaryMinusExpression: 1995case SyntaxKind.BitwiseNotExpression: 2007case SyntaxKind.LogicalNotExpression: 2011case SyntaxKind.AddressOfExpression: 2062if (previousToken.HasValue && (previousToken.Value != yieldStatement.ReturnOrBreakKeyword || yieldStatement.ReturnOrBreakKeyword.IsKind(SyntaxKind.BreakKeyword))) 2180if (token.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CommaToken) 2192switchLabel.Kind() != SyntaxKind.CaseSwitchLabel) 2211.FirstOrDefault(label => label.Kind() == SyntaxKind.CaseSwitchLabel) is CaseSwitchLabelSyntax firstCase) 2270if (variableDeclaration.IsParentKind(SyntaxKind.UsingStatement)) 2274if (variableDeclaration.IsParentKind(SyntaxKind.ForStatement))
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (1)
276.AccessorDeclaration(SyntaxKind.GetAccessorDeclaration)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\CSharpSimplificationHelpers.cs (5)
23if (SyntaxFacts.GetKeywordKind(syntaxToken.ValueText) == SyntaxKind.None && SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.None) 28if (SyntaxFacts.GetContextualKeywordKind(syntaxToken.ValueText) == SyntaxKind.UnderscoreToken) 34if (parentOfToken is SimpleNameSyntax && parent.Kind() == SyntaxKind.XmlNameAttribute) 41if (parent.Kind() == SyntaxKind.AliasQualifiedName &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\NameSyntaxIterator.cs (1)
27if (currentNode.Kind() == SyntaxKind.QualifiedName)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Utilities\SyntaxKindSet.cs (101)
11public static readonly ISet<SyntaxKind> AllTypeModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 13SyntaxKind.AbstractKeyword, 15SyntaxKind.ClosedKeyword, 17SyntaxKind.FileKeyword, 18SyntaxKind.InternalKeyword, 19SyntaxKind.NewKeyword, 20SyntaxKind.PublicKeyword, 21SyntaxKind.PrivateKeyword, 22SyntaxKind.ProtectedKeyword, 23SyntaxKind.SealedKeyword, 24SyntaxKind.StaticKeyword, 25SyntaxKind.UnsafeKeyword, 26SyntaxKind.ReadOnlyKeyword, 27SyntaxKind.RefKeyword 30public static readonly ISet<SyntaxKind> AllMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 32SyntaxKind.AbstractKeyword, 33SyntaxKind.AsyncKeyword, 34SyntaxKind.ExternKeyword, 35SyntaxKind.InternalKeyword, 36SyntaxKind.NewKeyword, 37SyntaxKind.OverrideKeyword, 38SyntaxKind.PublicKeyword, 39SyntaxKind.PrivateKeyword, 40SyntaxKind.ProtectedKeyword, 41SyntaxKind.ReadOnlyKeyword, 42SyntaxKind.RequiredKeyword, 43SyntaxKind.SealedKeyword, 44SyntaxKind.StaticKeyword, 45SyntaxKind.UnsafeKeyword, 46SyntaxKind.VirtualKeyword, 47SyntaxKind.VolatileKeyword, 50public static readonly ISet<SyntaxKind> AllGlobalMemberModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 52SyntaxKind.ExternKeyword, 53SyntaxKind.InternalKeyword, 54SyntaxKind.NewKeyword, 55SyntaxKind.OverrideKeyword, 56SyntaxKind.PublicKeyword, 57SyntaxKind.PrivateKeyword, 58SyntaxKind.ReadOnlyKeyword, 59SyntaxKind.StaticKeyword, 60SyntaxKind.UnsafeKeyword, 61SyntaxKind.VolatileKeyword, 64public static readonly ISet<SyntaxKind> AccessibilityModifiers = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 66SyntaxKind.PublicKeyword, 67SyntaxKind.PrivateKeyword, 68SyntaxKind.ProtectedKeyword, 69SyntaxKind.InternalKeyword, 72public static readonly ISet<SyntaxKind> AllTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 74SyntaxKind.InterfaceDeclaration, 75SyntaxKind.ClassDeclaration, 76SyntaxKind.RecordDeclaration, 77SyntaxKind.StructDeclaration, 78SyntaxKind.RecordStructDeclaration, 80SyntaxKind.UnionDeclaration, 82SyntaxKind.EnumDeclaration, 85public static readonly ISet<SyntaxKind> ClassInterfaceStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 87SyntaxKind.InterfaceDeclaration, 88SyntaxKind.ClassDeclaration, 89SyntaxKind.RecordDeclaration, 90SyntaxKind.StructDeclaration, 91SyntaxKind.RecordStructDeclaration, 93SyntaxKind.UnionDeclaration, 97public static readonly ISet<SyntaxKind> NonEnumTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 99SyntaxKind.ClassDeclaration, 101SyntaxKind.ExtensionBlockDeclaration, 102SyntaxKind.UnionDeclaration, 104SyntaxKind.InterfaceDeclaration, 105SyntaxKind.RecordDeclaration, 106SyntaxKind.RecordStructDeclaration, 107SyntaxKind.StructDeclaration, 110public static readonly ISet<SyntaxKind> ClassInterfaceRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 112SyntaxKind.InterfaceDeclaration, 113SyntaxKind.ClassDeclaration, 114SyntaxKind.RecordDeclaration, 117public static readonly ISet<SyntaxKind> ClassRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 119SyntaxKind.ClassDeclaration, 120SyntaxKind.RecordDeclaration, 123public static readonly ISet<SyntaxKind> ClassStructRecordTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 125SyntaxKind.ClassDeclaration, 126SyntaxKind.RecordDeclaration, 127SyntaxKind.StructDeclaration, 128SyntaxKind.RecordStructDeclaration, 130SyntaxKind.UnionDeclaration, 134public static readonly ISet<SyntaxKind> StructOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 136SyntaxKind.StructDeclaration, 137SyntaxKind.RecordStructDeclaration, 139SyntaxKind.UnionDeclaration, 143public static readonly ISet<SyntaxKind> InterfaceOnlyTypeDeclarations = new HashSet<SyntaxKind>(SyntaxFacts.EqualityComparer) 145SyntaxKind.InterfaceDeclaration,
SuperFileCheck (3)
Program.cs (3)
241namespaceDecl.Name.DescendantTokens().Where(x => x.IsKind(SyntaxKind.IdentifierToken)).Select(x => x.ValueText); 256.Where(x => x.IsKind(SyntaxKind.SingleLineCommentTrivia)); 290return !x.Token.Parent.Ancestors().Any(p => p.IsKind(SyntaxKind.MethodDeclaration) && p.Span.Contains(x.Span));
System.Text.Json.SourceGeneration (10)
Helpers\RoslynExtensions.cs (9)
227=> SyntaxFacts.GetKeywordKind(symbol.Name) != SyntaxKind.None || SyntaxFacts.GetContextualKeywordKind(symbol.Name) != SyntaxKind.None; 262case SyntaxKind.ClassDeclaration: 264case SyntaxKind.InterfaceDeclaration: 266case SyntaxKind.StructDeclaration: 268case SyntaxKind.RecordDeclaration: 270case SyntaxKind.RecordStructDeclaration: 272case SyntaxKind.EnumDeclaration: 274case SyntaxKind.DelegateDeclaration:
JsonSourceGenerator.Parser.cs (1)
202isPartialType |= 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);